-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBOJ_1019.cpp
More file actions
61 lines (51 loc) · 983 Bytes
/
BOJ_1019.cpp
File metadata and controls
61 lines (51 loc) · 983 Bytes
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
59
60
61
// 21/10/21
#include <iostream>
using namespace std;
long long arr[10];
long long n;
void Solve(void)
{
long long chiper = 1;
long long c= 0;
while (1)
{
if (chiper*10 > n)
break;
chiper *= 10;
c ++;
}
bool first_zero_check = true;
while (c>=0)
{
long long num = n/chiper;
n%=chiper;
if (num > 0)
{
for (int i=0; i<10; i++)
arr[i] += (num*chiper*c/10);
}
for (int i=0; i<num; i++)
arr[i] += chiper;
arr[num] += (n+1);
if (first_zero_check)
{
int temp = chiper;
while (temp)
{
arr[0] -= temp;
temp /= 10;
}
first_zero_check = false;
}
chiper /= 10;
c --;
}
}
int main(void)
{
cin >> n;
Solve();
for (int i=0; i<10; i++)
cout<<arr[i]<<" ";
return 0;
}