跳到正文

休闲·娱乐

随机洛谷、一本通题目器

Shadow_T约 4 分钟
原文

这是 2026年5月5日 存档的第 1 版,不是当前版本。查看当前版本

文章信息与版本

文章信息

发布
2023年8月19日
收录
2026年5月5日
更新
2026年11月7日
篇幅
约 4 分钟

版本

  1. v2当前
  2. v1
C++
#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 的代码改装而来