## CCC '17 J2 - Shifty Sum

View as PDF

Points: 3
Time limit: 1.0s
Memory limit: 64M

Problem type
##### Canadian Computing Competition: 2017 Stage 1, Junior #2

Suppose we have a number like . 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 . If we shift the number again we get the number . 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 and a non-negative integer . You must add together and all the numbers you get by shifting a total of times.

For example, the shifty sum when is and is is: . As another example, the shifty sum when is and is is .

#### Input Specification

The first line of input contains the number  . The second line of input contains , the number of times to shift  .

#### Output Specification

Output the integer which is the shifty sum of by .

#### Sample Input

12
3

#### Sample Output

13332

• commented on Feb. 12, 2021, 8:24 p.m.

In my opinion, a for loop would be the easiest and shortest way to solve this problem.

• commented on Jan. 31, 2022, 7:57 p.m.

Honestly I Just used if and else if statements and I think they are the easiest to work with

• commented on June 9, 2021, 12:04 p.m.

Not necessarily. There is a solution that is O(1)

• commented on March 10, 2017, 3:32 p.m.

This comment is hidden due to too much negative feedback. Show it anyway.

• commented on March 10, 2017, 3:59 p.m.

Yes, because you submitted an editorial solution to a lot of problems without solving them yourself before. Each editorial is accompanied by a large warning that copy/pasting editorials can lead to bans on submitting a problem, so is it a surprise that you got banned doing so?

I've unbanned you from this problem, but this isn't something that'll happen again.