- C++
问一下明明的随机数怎么做?
- 2023-1-31 10:44:50 @
❤️
5 条评论
-
LJY LV 1 @ 2024-7-31 11:22:41
桶排
# include <bits/stdc++.h> using namespace std; int main(){ int u,n,num=0,x; cin>>n; int a[1001]={0}; for (u=1;u<=n;u++) { cin>>x; a[x]+=1; if (a[x]<=1) num+=1; } cout<<num<<endl; for (u=0;u<1001;u++) if (a[u]!=0) cout<<u<<" "; return 0; }
-
2024-2-4 17:49:03@
请看题解
-
2023-7-2 11:32:39@
真的太6了
-
2023-5-15 17:56:00@
#include<bits/stdc++.h> using namespace std; int main() { int n,x; cin>>n; int sum(0),bus[1002]={0}; for(int i=1;i<=n;i++){ cin>>x; if(bus[x]) continue; bus[x]++; sum++; } cout<<sum<<endl; for(int i=1;i<=1000;i++) if(bus[i]) cout<<i<<' '; cout<<endl; return 0; }
-
2023-3-4 10:24:37@
6
- 1