跳到正文

个人记录

Lougu随机跳题

joe303约 1 分钟
原文
文章信息与版本

文章信息

发布
2025年7月17日
收录
2025年12月12日
更新
2026年11月13日
篇幅
约 1 分钟

版本

  1. v1当前
C++
#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
using namespace std;
inline string xxx(int i){
	string s;
	while(i){
		s+=(char(i%10)+'0');
		i/=10;
	}
	return s;
}
int n,m; 
int main(){
	srand(time(0));
	cout<<"欢迎来到Lougu随机跳题(P1000~P10000)!\n  请问你要跳几题:";
	cin>>n;
	m=n;
	system("cls");
	system("color 3");
	while(n--){
		cout<<"正在跳转第"<<m-n<<"题\n";
		string str = "start ";
		str += "https://www.luogu.com.cn/problem/P";
		str+=xxx(rand()%9000+1000);
//		cout<<str<<endl;
		system(str.c_str());
		system("cls");
	}
	return 0;
}
原文