T491350
  • 板块学术版
  • 楼主Matthew138
  • 当前回复1
  • 已保存回复1
  • 发布时间2024/8/6 15:39
  • 上次更新2024/8/6 16:32:26
查看原帖
T491350
1140105
Matthew138楼主2024/8/6 15:39

数据生成代码

#include <bits/stdc++.h>
using namespace std;
int main()
{
	srand(time(0));
	for(int p=101;p<=118;p++)
	{
		int n,m,k,l,x,y,z,a[1001];
		l=rand()%1000000+1;
		srand(rand());
		n=rand()%6; 
		srand(rand());
		m=5-n;
		k=rand()%1000000+1;
		srand(rand());
		x=rand()%5+1;
		srand(rand());
		y=rand()%5+1;
		if(x==y){
			y--;
		}
		srand(rand());
		z=rand()%5+1;
		if(z==x){
			z--;
		}
		for(int j=1;j<=n+m;j++){
			if(j<=n){
				a[j]=x;
			}else{
				if(j%2==0){
					a[j]=y;
				}else{
					a[j]=z;
				}
			}
		}
		ofstream out;
        out.open(to_string(p)+".in.in");
        out<<n<<" "<<m<<endl;
        for(int j=1;j<=n+m;j++){
        	out<<a[j]<<" ";
		}
		out<< endl;
		out<<x<<" "<<y<<" "<<z<< endl;
		out<<k<< endl;
		out<<l<< endl;
        out.close();
        out.open(to_string(p)+".out.out");
        int cnt=1;
        while(l>0){
        	if(cnt%4==1&&cnt!=1){
        		cnt++;
			}else{
				l-=k;
			}
        	cnt++; 
		}
		out<<cnt;
        out.close();
	}
	return 0;
 } 

2024/8/6 15:39
加载中...