输入:4 5 3 1 2 5 2 3 2 1,统计守艺作品编号次数,输出是?
#include <iostream>
using namespace std;
int main(){
int a[6] = {};
int x;
for(int i = 1; i <= 10; i++)
{
cin >> x;
a[x]++;
}
for(int i = 1; i <= 5; i++)
{
cout << a[i] << " ";
}
return 0;
}
输入:4 5 3 1 2 5 2 3 2 1
2 1 2 1 2
2 3 1 1 3
3 2 1 2 2
2 3 2 1 2