Create 1720.c

This commit is contained in:
KiritoTRw 2016-04-28 08:24:39 +08:00
parent 399ae06c7a
commit 5286254a6d

28
QUSTOJ/1720.c Normal file
View File

@ -0,0 +1,28 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char buff[64];
int cnt[10];
int main()
{
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
sprintf(buff,"%d",i);
int len=strlen(buff);
for(int j=0;j<len;j++)
{
++cnt[buff[j]-'0'];
}
}
for(int i=0;i<9;i++)
{
printf("%d ",cnt[i]);
}
printf("%d\n",cnt[9]);
return 0;
}