【算法竞赛入门经典】习题3-3 数数字(Digit Counting,ACMICPC Danang 2007,UVa 1225)

it2022-05-05  146

#include<stdio.h> #include<string.h> int a[15]={0}; int main(){ int n; scanf("%d\n",&n); while(n--){ char c; scanf("%c",&c); a[c-'0']++; } for(int i=0;i<10;i++){ if(i<9) printf("%d ",a[i]); else printf("%d\n",a[i]); } return 0; }

最新回复(0)