mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 1720.c
This commit is contained in:
parent
399ae06c7a
commit
5286254a6d
28
QUSTOJ/1720.c
Normal file
28
QUSTOJ/1720.c
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user