Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 500 点
問題文
\displaystyle \sum_{k=0}^{10^{100}} \left \lfloor \frac{X}{10^k} \right \rfloor を求めてください。
注釈
\lfloor A \rfloor は、 A の小数点以下を切り捨てた値を指します。
制約
- X は整数
- 1 \le X < 10^{500000}
入力
入力は以下の形式で標準入力から与えられる。
X
出力
答えを整数として出力せよ。
但し、たとえ答えが大きな整数であっても、求める答えを正確に整数として出力する必要がある。たとえば、 2.33e+21
のような指数表記や、 0523
のような先頭に不要な 0 を付けたような表記は許されない。
入力例 1
1225
出力例 1
1360
求める値は、 1225+122+12+1+0+0+\dots+0=1360 となります。
入力例 2
99999
出力例 2
111105
繰り上がりに注意してください。
入力例 3
314159265358979323846264338327950288419716939937510
出力例 3
349065850398865915384738153697722542688574377708317
入力される値も出力すべき値も非常に大きくなる場合があります。
Score : 500 points
Problem Statement
Find \displaystyle \sum_{k=0}^{10^{100}} \left \lfloor \frac{X}{10^k} \right \rfloor.
Notes
\lfloor A \rfloor denotes the value of A truncated to an integer.
Constraints
- X is an integer.
- 1 \le X < 10^{500000}
Input
Input is given from Standard Input in the following format:
X
Output
Print the answer as an integer.
Here, the answer must be precisely printed as an integer, even if it is large. It is not allowed to use exponential notation, such as 2.33e+21
, or print unnecessary leading zeros, as in 0523
.
Sample Input 1
1225
Sample Output 1
1360
The value we seek is 1225+122+12+1+0+0+\dots+0=1360.
Sample Input 2
99999
Sample Output 2
111105
Beware of carries.
Sample Input 3
314159265358979323846264338327950288419716939937510
Sample Output 3
349065850398865915384738153697722542688574377708317
The values in input and output can both be enormous.