1 条题解

  • 0
    @ 2024-8-7 12:47:41

    Solution

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

    Code

    参考代码:

    #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;
    }
    
    • 1

    信息

    ID
    12
    时间
    1000ms
    内存
    512MiB
    难度
    1
    标签
    (无)
    递交数
    3
    已通过
    2
    上传者