a835: Shifty Sum
Tags : 累加 迴圈
Accepted rate : 37人/40人 ( 92% ) [非即時]
評分方式:
Tolerant

最近更新 : 2022-10-16 22:46

Content

Suppose we have a number like 12. Let’s define shifting a number to mean adding a zero at the end. For example, if we shift that number once, we get the number 120. If we shift the number again we get the number 1200. We can shift the number as many times as we want.

In this problem you will be calculating a shifty sum, which is the sum of a number and the numbers we get by shifting. Specifically, you will be given the starting number N and a non-negative integer k. You must add together N and all the numbers you get by shifting a total of k times.

For example, the shifty sum when N is 12 and k is 1 is: 12 + 120 = 132. As another example, the shifty sum when N is 12 and k is 3 is 12 + 120 + 1200 + 12000 = 13332.

Input

The first line of input contains the number N (1 ≤ N ≤ 10000). The second line of input contains k, the number of times to shift N (0 ≤ k ≤ 5).

Output

Output the integer which is the shifty sum of N by k.

Sample Input #1
12
3
Sample Output #1
13332
測資資訊:
記憶體限制: 64 MB
公開 測資點#0 (9%): 1.0s , <1K
公開 測資點#1 (9%): 0.9090909090909091s , <1K
公開 測資點#2 (9%): 0.9090909090909091s , <1K
公開 測資點#3 (9%): 0.9090909090909091s , <1K
公開 測資點#4 (9%): 0.9090909090909091s , <1K
公開 測資點#5 (9%): 0.9090909090909091s , <1K
公開 測資點#6 (9%): 0.9090909090909091s , <1K
公開 測資點#7 (9%): 0.9090909090909091s , <1K
公開 測資點#8 (9%): 0.9090909090909091s , <1K
公開 測資點#9 (9%): 0.9090909090909091s , <1K
公開 測資點#10 (10%): 0.9090909090909091s , <1K
Hint :
Tags:
累加 迴圈
出處:
CCC2017 [管理者:
issin@g.puic... (冼一心老師)
]


ID User Problem Subject Hit Post Date
沒有發現任何「解題報告」