思路
首先判断题号 是否在主题库,如果是( 是数字)就在字符串前面加一个 P。最后输出 https://www.luogu.com.cn/problem/ 加上 即可。
AC CODE
#include<bits/stdc++.h>
using namespace std;
int read(){int x=0;char f=1,ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();return x*f;}
int main(){
int T=read();
while(T--){
string s;cin>>s;
if(isdigit(s[0]))
s='P'+s;
cout<<"https://www.luogu.com.cn/problem/"<<s<<"\n";
}
return 0;
}