随机跳题

· · 个人记录

由于B题库题目过于**(评级过分,至少本人认为),所以一下只供给除B题库外的所有题库的题。

#include <bits/stdc++.h>
using namespace std;
string s = "start https://www.luogu.com.cn/problem/";
int x;
void solve(){
    int res = rand() % 5;
    if(res == 0){
        string p = s + "P" + to_string(rand() % 9000 + 1000);
        system(p.c_str());
    }
    if(res == 1){
        string p = s + "CF" + to_string(rand() % 2000) + (char)(rand() % 5 + 'A');
        system(p.c_str());
    }
    if(res == 2){
        string p = s + "AT_abc" + to_string(rand() % 300) + "_" + (char)(rand() % 5 + 'A');
        system(p.c_str());
    }
    if(res == 3){
        string p = s + "SP" + to_string(rand() % 30000);
        system(p.c_str());
    }
    if(res == 4){
        string p = s + "UVA" + to_string(rand() % 10000);
        system(p.c_str());
    }
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0) , cout.tie(0);
    srand(time(0));
    cout << "请输入随机跳转的数量";
    for(cin >> x; x--; solve());
    return 0;
}

不含SP和UVA。

#include <bits/stdc++.h>
using namespace std;
string s = "start https://www.luogu.com.cn/problem/";
int x;
void solve(){
    int res = rand() % 3;
    if(res == 0){
        string p = s + "P" + to_string(rand() % 9000 + 1000);
        system(p.c_str());
    }
    if(res == 1){
        string p = s + "CF" + to_string(rand() % 2000) + (char)(rand() % 5 + 'A');
        system(p.c_str());
    }
    if(res == 2){
        string p = s + "AT_abc" + to_string(rand() % 300) + "_" + (char)(rand() % 5 + 'A');
        system(p.c_str());
    }
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0) , cout.tie(0);
    srand(time(0));
    cout << "请输入随机跳转的数量";
    for(cin >> x; x--; solve());
    return 0;
}