the seniority of N-N employees in a given company requires that the number of employees in each seniority segment be output by seniority.
Input format:
The input first gives a positive integerNn ( \le 10^5< Span class= "base textstyle uncramped" >≤10?5?? ), that is, the total number of employees; then give n< Span class= "Strut bottom" >n integers, that is, the seniority of each employee, in the range of [0, 50].
Output format:
The number of employees per seniority is output in ascending order of seniority, in the form of: "Seniority: Number of people". Each item occupies a row. If the number is 0, the item is not exported.
Input Sample:
810 2 0 5 7 2 5 2
Sample output:
0:12:35:27:110:1
- Time limit: 400ms
- Memory Limit: 64MB
- Code length limit: 16kB
- Procedure: System default
- Chen
- Unit: Zhejiang University
#include <iostream>using namespacestd;intMain () {intage[Wuyi]={0}; intn,p; CIN>>N; for(intI=0; i<n;i++) {cin>>p; AGE[P]++; } for(intI=0;i<Wuyi; i++){ if(age[i]==0)Continue; cout<<i<<":"<<age[i]<<Endl; } return 0;}
Please choose the g++ compiler
Data structure and algorithm topic set (Chinese)--5-13 statistical seniority (20 points)--bucket sequencing