跳到正文

题解

P11784 题解

ikunTLE约 1 分钟
原文
文章信息与版本

文章信息

发布
2025年3月8日
收录
2025年12月12日
更新
2026年11月11日
篇幅
约 1 分钟
获赞
2
题目
P11784

版本

  1. v1当前

题目传送门

思路

首先判断题号 SS 是否在主题库,如果是(S0S_0 是数字)就在字符串前面加一个 P。最后输出 https://www.luogu.com.cn/problem/ 加上 SS 即可。

AC CODE

C++
#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;
}
原文
存档评论2 条抓取于