Logo wfirstzhang的博客

博客

洛谷题单转vjudge题单

2025-10-10 08:43:38 By wfirstzhang

使用方法:洛谷题单左下角多选,右下角导出 $\texttt{T}$纯题号,输入进去会输出 vjudge 题单格式。

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

int main() {
    using namespace std;
    string src;
    cin >> src;
    src.push_back(',');
    string tmp;
    vector<string> set;
    for(auto ch : src)
        if(ch == ',')
        {
            set.push_back(tmp); 
            tmp.clear();
        }
        else
            tmp.push_back(ch);
    sort(set.begin(), set.end());
    for(const auto& i : set)
    {
        cout << "[problem:";
        if(i.size() > 2 && i.substr(0, 2) == "AT")
            cout << "AtCoder-" << i.substr(3);
        else if(i.size() > 1 && i.substr(0, 2) == "CF")
            cout << "CodeForces-" << i.substr(2);
        else if(i.size() > 2 && i.substr(0, 3) == "UVA")
            cout << "UVA-" << i.substr(3);
        else
            cout << "洛谷-" << i;
        cout << "]\n";
    }  
    return 0;
}

评论

暂无评论

发表评论

可以用@mike来提到mike这个用户,mike会被高亮显示。如果你真的想打“@”这个字符,请用“@@”。