跳到正文

题解

题解:FAOI-R4 A. 问题跳转

喵仔牛奶约 1 分钟
原文
文章信息与版本

文章信息

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

版本

  1. v1当前

Solution

观察发现,需要开头加 P 的题号都是以数字开头的。若以数字开头,在字符串最前面加上 P 即可。

Code

参考代码:

C++
#include <bits/stdc++.h>
#define REP(i, l, r) for (int i = (l); i <= (r); ++ i)
#define DEP(i, r, l) for (int i = (r); i >= (l); -- i)
#define fi first
#define se second
#define pb emplace_back
#define mems(x, v) memset((x), (v), sizeof(x))
using namespace std;
namespace Milkcat {
	typedef long long LL;
	typedef pair<LL, LL> pii;
	const int N = 1e6 + 5;
	string s;
	int main() {
		cin >> s;
		if (isdigit(s[0])) s = "P" + s;
		cout << "https://www.luogu.com.cn/problem/" << s << '\n';
		return 0;
	}
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	int T = 1; cin >> T;
	while (T --) Milkcat::main();
	return 0;
}
原文
存档评论17 条抓取于