Rand函数
  • 板块灌水区
  • 楼主_zhx
  • 当前回复4
  • 已保存回复4
  • 发布时间2023/10/26 19:33
  • 上次更新2023/11/2 11:18:46
查看原帖
Rand函数
784712
_zhx楼主2023/10/26 19:33

每次 aa,bb,cc,都是一样的

#include<bits/stdc++.h>
using namespace std;
int main()
{
	srand(time(0));
	ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);		
	int t=rand()%50+1;
	srand(time(0));
	cout<<t<<'\n';
	while(t--)
	{
		srand(time(0));
		int a=rand()%10000+1;
		srand(time(0));
		int b=rand()%12+1,c;
		srand(time(0));
		if(b==2)
		{
			if(a%4==0||a%100==0&&a%400==0) c=rand()%29+1,srand(time(0));	
			else c=rand()%28+1,srand(time(0));
		}
		else c=rand()%31+1;
		srand(time(0));
		cout<<a<<' '<<b<<' '<<c<<'\n';
	}    
    return 0;
}
2023/10/26 19:33
加载中...