专栏文章

P11784 「FAOI-R4」问题跳转 题解

P11784题解参与者 3已保存评论 3

文章操作

快速查看文章及其快照的属性,并进行相关操作。

当前评论
3 条
当前快照
1 份
快照标识符
@mipzs0sa
此快照首次捕获于
2025/12/03 20:37
3 个月前
此快照最后确认于
2025/12/03 20:37
3 个月前
查看原文

思路:

按题意模拟即可,很容易发现,以数字开头的题号都需要开头加 P
输出的网址有两种情况:
  • 如果以数字开头的题号,则输出 https://www.luogu.com.cn/problem/P,再输出题号。
  • 如果以 PBCASUT 开头的题号,则输出 https://www.luogu.com.cn/problem/,再输出题号。

AC Code:

CPP
#include<bits/stdc++.h>
using namespace std;
int t;
string s; 
int main() {
    cin>>t;
    for(int i=1;i<=t;i++){
    	cin>>s;
    	if(s[0]>='0' && s[0]<='9')
          cout<<"https://www.luogu.com.cn/problem/P"<<s;  //第一种情况
    	else
    		cout<<"https://www.luogu.com.cn/problem/"<<s; //第二种情况
    	cout<<endl;
	}
    return 0;
}

评论

3 条评论,欢迎与作者交流。

正在加载评论...