No.604 Birthday Allowance
タグ : / 解いたユーザー数 246
作問者 :
nmnmnmnmnmnmnm
/ テスター :
Problem Statement
Starting from his 1st birthday, Yuki receives an allowance on his birthday every year.
・If his age on the birthday is not a multiple of $A$, he receives an allowance of 1 yen.
・If his age on the birthday is a multiple of $A$, he receives an allowance of $B$ yen.
On which birthday (at what age) does the total of his birthday allowances first reach $C$ yen or more?
Note that Yuki never dies.
Input
$A$ $B$ $C$
$A$, $B$, $C$ are positive integers.
$1 \le$ A,B,C $\le 1000000000000000000=10^{18}$.
Output
Output the answer on one line.
End the output with a newline.
Sample
Sample 1
Input
3 5 8
Output
4
On his 1st birthday, he receives 1 yen.
On his 2nd birthday, he receives 1 yen.
On his 3rd birthday, he receives 5 yen.
On his 4th birthday, he receives 1 yen.
At age 4, the total allowance has become 8 yen.
Since the total allowance has reached 8 yen or more, the answer is 4.
Sample 2
Input
2 2 8
Output
6
On his 1st birthday, he receives 1 yen.
On his 2nd birthday, he receives 2 yen.
On his 3rd birthday, he receives 1 yen.
On his 4th birthday, he receives 2 yen.
On his 5th birthday, he receives 1 yen.
On his 6th birthday, he receives 2 yen.
At age 6, the total allowance has become 9 yen.
Since the total allowance has reached 8 yen or more, the answer is 6.
Sample 3
Input
1000000000000000000 1000000000000000000 1000000000000000000
Output
1000000000000000000
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。