今天尝试了一下用C++生成数据,参考了这篇文章。
主要过程是你需要先写一个标算
#include<bits/stdc++.h>
using namespace std;
int ans;
int main()
{
cout<<ans<<endl;
return 0;
}
接着使用这个程序
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<queue>
#include<vector>
#include<algorithm>
#include<ctime>
#include<cmath>
#include<fstream>
using namespace std;
long long n,m;
char b[10000005];
char cb[10000005];
void makedata1(int i)
{
sprintf(b,"data%d.in",i);
freopen(b,"w",stdout);
}
void makedata2(int i)
{
fclose(stdout);
sprintf(cb,"std.exe < data%d.in > basketball%d.out",i,i);
system(cb);
}
int main()
{
srand(time(0));
for(int nw=1;nw<=10;nw++)
{
makedata1(nw);
n=rand()%9999;//你需要的数据
cout<<n<<endl;
for(int i=1;i<=n;i++)
cout<<rand()%1000000<<endl;
makedata2(nw);
}
return 0;
}