随机洛谷、一本通题目器
#include<bits/stdc++.h>
#include <windows.h>
using namespace std;
const int N=1e5+7;
string To_string(int a)
{
string g="";
while(a>0)
g+=(a%10+'0'),a/=10;
reverse(g.begin(),g.end());
return g;
}
int main(){
cout<<"欢迎使用题目随机器!\n";
cout<<"输入 P 可生成洛谷P系列题目\n";
cout<<"输入 B1 可生成洛谷B系列2001-2148题\n";
cout<<"输入 B2 可生成洛谷B系列3600-3821题\n";
cout<<"输入 Y 可生成一本通系列1000-2067题\n" ;
cout<<"输入 UVA 可生成洛谷UVA系列100-13292题\n" ;
cout<<"按下 ctrl+z 可结束\n";
cout<<"请期待第二版!\n";
cout<<"敬请享受coding的欢乐吧!\n";
string a;
srand(time(0));
while(cin>>a){
if(a=="P"){
int x=rand()%(9572-1000+1)+1000;
string s="P"+To_string(x);
const string st="start https://www.luogu.com.cn/problem/"+s;
system(st.c_str());
}
else if(a=="B1"){
int y=rand()%(2148-2001+1)+2001;
string s="B"+To_string(y);
const string st="start https://www.luogu.com.cn/problem/"+s;
system(st.c_str());
}
else if(a=="B2"){
int z=rand()%(3821-3600+1)+3600;
string s="B"+To_string(z);
const string st="start https://www.luogu.com.cn/problem/"+s;
system(st.c_str());
}
else if(a=="Y")
{
int z=rand()%(2067-1000+1)+1000;
string s=To_string(z);
const string st="start http://ybt.ssoier.cn:8088/problem_show.php?pid="+s;
system(st.c_str());
}
else if(a=="UVA")
{
int z=rand()%(13292-100+1)+100;
string s=To_string(z);
const string st="start https://www.luogu.com.cn/problem/UVA"+s;
system(st.c_str());
}
else{
cout<<"我不理解您的意思,请检查字母大小写等问题!\n";
}
}
return 0;
}
由 meng_cen 的代码改装而来