P11784 「FAOI-R4」问题跳转

P11784 「FAOI-R4」问题跳转

题目传送门

题目思路

按题意模拟即可。
由题意可得,洛谷题目的题号首字母有且仅有 PBCASUT。并且对于第一项字母是 P 的题目,P 可以省略。
综上可得:

  • \(S_1\) 等于 PBCASUT 的任意一个时,输出 https://www.luogu.com.cn/problem/\(S\) 即可。
  • 反之,输出 https://www.luogu.com.cn/problem/P\(S\)

代码实现

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
ll T;
int main(){
	cin>>T;
	while(T--){
		cin>>s;
		if(s[0]!='P'&&s[0]!='B'&&s[0]!='C'&&s[0]!='A'&&s[0]!='S'&&s[0]!='U'&&s[0]!='T') cout<<"https://www.luogu.com.cn/problem/P"<<s<<"\n";
		else cout<<"https://www.luogu.com.cn/problem/"<<s<<"\n";
	}
	return 0;
}
posted @ 2025-02-23 21:22  M1_Byte  阅读(24)  评论(0)    收藏  举报