-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewNumber.c
58 lines (52 loc) · 1.22 KB
/
newNumber.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <stdio.h>
void count(int input);
int main(){
int time;
scanf("%d", &time);
for(int c = 0; c < time; c++){
int input;
scanf("%d", &input);
count(input);
}
return 0;
}
void count(int input){
int output[10];
for(int count = 0; count < 10; count++){
output[count] = 0;
}
int hun = input / 100;
for(int count = 1; count <= hun; count++){
output[count] += 100;
}
for(int count = 0; count < 10; count++){
output[count] += hun;
}
int ten = input % 100;
int ten1 = ten / 10;
for(int count = 0; count < 10; count++){
output[count] += ten1;
}
for(int count = 0; count <= ten1; count++){
if(hun == 0 && count == 0){
continue;
}
output[count] += 10;
}
int sin = (input % 100) % 10;
for(int count = 0; count <= sin; count++){
if(hun == 0 && ten1 == 0 && count == 0){
continue;
}
output[count]++;
}
int sin2 = input / 10;
for(int count = 0; count < 10; count++){
output[count] += sin2;
}
output[0]--;
for(int count = 0; count < 10; count++){
printf("%d ", output[count]);
}
putchar('\n');
}