随即数据生成 根据题目的输入格式生成
例:
#include<stdio.h>
#include<string>
#include<cstring>
#include<queue>
#include<algorithm>
#include<functional>
#include<vector>
#include<iomanip>
#include<math.h>
#include<iostream>
#include<sstream>
#include<set>
#include<ctime>
using namespace std;
int main()
{
freopen("C://Users//hss//Documents//ACM//duipai//data.txt","w",stdout);
srand(time(0));
int T=1500;
while (T--)
{
int Cash=rand()% 100001;
int N=rand()%11;
cout<<Cash<<' '<<N;
for (int i=0;i<N;i++)
{
int ni=rand()%1001;
int di=rand()%1000+1;
cout<<' '<<ni<<' '<<di;
}
cout<<endl;
}
return 0;
}
在正确的程序和你的程序开头加入以下代码:
freopen("C://Users//hss//Documents//ACM//duipai//data.txt","r",stdin);
freopen("C://Users//hss//Documents//ACM//duipai//MyOut.txt","w",stdout);
freopen("C://Users//hss//Documents//ACM//duipai//data.txt","r",stdin);
freopen("C://Users//hss//Documents//ACM//duipai//MyOut2.txt","w",stdout);
之后建立duipai.txt 输入以下内容
@echo off
fc MyOut.txt MyOut2.txt
pause
之后扩展名改为bat
分别运行即可