C++对拍数据生成
1 #include<map> 2 #include<ctime> 3 #include<queue> 4 #include<cmath> 5 #include<cstdio> 6 #include<vector> 7 #include<cstring> 8 #include<cstdlib> 9 #include<iostream> 10 #include<algorithm> 11 #include<stack> 12 using namespace std; 13 int n,m,i,x,y,z,t; 14 int main() 15 { 16 srand(time(NULL)); 17 freopen("data.in","w",stdout); 18 n=rand()%1000+1; m=rand()%1000+1; 19 printf("%d %d\n",n,m); 20 for(i=1;i<=m;i++) 21 { 22 x=rand()%n+1; 23 y=rand()%n+1; 24 if(x>y){t=x;x=y;y=t;} 25 z=rand()%100+1; 26 printf("%d %d %d\n",x,y,z); 27 } 28 return 0; 29 }
null