关于造数据
  • 板块灌水区
  • 楼主Anonymely
  • 当前回复4
  • 已保存回复4
  • 发布时间2022/5/4 17:40
  • 上次更新2023/10/28 02:10:17
查看原帖
关于造数据
550957
Anonymely楼主2022/5/4 17:40
#include<bits/stdc++.h>
using namespace std;
#define ll long long

map<ll,ll>mp;


ll random(ll mod1,ll mod2){
	ll mod=(mod2-mod1+1);
    ll n1, n2, n3, n4, ans;
    n1 = rand();
    n2 = rand();
    n3 = rand();
    n4 = rand();
    ans = n1 * n2 % mod;
    ans = ans * n3 % mod;
    ans = ans * n4 % mod;
    return ans+mod1;
}

int main(){
	ios::sync_with_stdio(0);
	cout.tie(0);
    srand((unsigned)time(0));
    freopen("make.txt","w",stdout);
    ll n=1e6; 
    ll m=1e6;
    cout<<n<<" "<<m<<endl;
    for(int i=1;i<=n;i++){
    	ll x=random(1,1e6-i);
    	cout<<x<<' ';
	}
	cout<<endl;
	for(int i=1;i<=n;i++){
    	ll x=random(1,1000);
    	cout<<x<<' ';
	}
	cout<<endl;
	for(int i=1;i<=m;i++){
		cout<<random(1,n)<<' '<<random(1,n-1000)<<endl;
	}
	//fclose(stdout);
    return 0;
}

这是我的造数据代码,但是在n,m=1e6的时候输出的txt就不全,不知道为什么,求大佬指点

2022/5/4 17:40
加载中...