atcoder#ARC112B. [ARC112B] -- - B
[ARC112B] -- - B
Score : points
Problem Statement
Snuke has come to Seisu-ya (integer shop) with an integer in his hand. In Seiyu-ya, you can exchange your integer for another integer by paying money.
More specifically, you can use the following two services any number of times in any order:
- Pay yen (the currency of Japan) to multiply your integer by .
- Pay yen to subtract from your integer.
How many integers are there that Snuke can get for at most yen?
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
11 2
3
There are three numbers that Snuke can get: , , and , as follows:
- by doing nothing, he can get for yen;
- by multiplying by , he can get for yen;
- by subtracting from , he can get for yen.
0 4
4
There are four numbers that Snuke can get: , , , and , as follows:
- by doing nothing, he can get for yen;
- by subtracting from , he can get for yen;
- by subtracting from and then multiplying by , he can get for yen;
- by subtracting from and then subtracting again, he can get for yen.
112 20210213
20210436
-211 1000000000000000000
1000000000000000422