跳到正文

个人记录

wu

HZY1618yzh约 1 分钟
原文
文章信息与版本

文章信息

发布
2025年1月5日
收录
2025年12月12日
更新
2026年9月5日
篇幅
约 1 分钟

版本

  1. v1当前
C++
#include<bits/stdc++.h>
using namespace std;
int n,a[366],s;
int main(){
	cin>>n;
	time_t t;
	srand((unsigned)time(&t));
	for(int i=1;i<=n;i++){
		s=rand()%365;
		cout<<s+1<<' ';
		a[s+1]++;
	}
	cout<<endl;
	for(int i=1;i<=365;i++){
		if(a[i]>=2){
			cout<<i<<":"<<a[i]<<' ';
		}
	}
	return 0;
}
原文