- 直方图
数组开少的神奇结果
- 2024-1-18 20:14:07 @
#include <bits/stdc++.h>
using namespace std;
long long e,c; ;
int a[1000000],b[10000];
int main()
{
cin>>e;
for(int i=0;i<e;i++)
{
cin>>a[i];
if(a[i]>=c) {c=a[i];}
}
for(int i=0;i<=c;i++)
{ for(int j=0;j<e;j++)
if(a[j]==i) b[i]+=1;
}
for(int f=0;f<=c;f++)
{
cout<<b[f]<<endl;
}
return 0;
}
1 comments
-
经开一中2026届11班关泽瑞 LV 6 @ 2024-1-26 17:12:22
- 1
Information
- ID
- 597
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 2
- Tags
- (None)
- # Submissions
- 58
- Accepted
- 37
- Uploaded By