結果
問題 |
No.604 誕生日のお小遣い
|
ユーザー |
![]() |
提出日時 | 2019-05-08 12:00:37 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 34 ms / 1,000 ms |
コード長 | 550 bytes |
コンパイル時間 | 129 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-11-21 19:29:15 |
合計ジャッジ時間 | 1,764 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
a, b, c = [ int (v) for v in input().split() ] def getmoney(y): u = y // a v = y + (b-1) * u return v stop = 0 high = c low = 1 mid = (high + low) // 2 t = 0 anslist = [] while stop == 0: anslist.append(mid) if getmoney(mid) == c: stop = 1 ans = mid elif getmoney(mid) > c: high = mid mid = (high + low) // 2 else: low = mid mid = (high + low) // 2 if len(anslist)> 4 and [anslist[-1],anslist[-2]] == [anslist[-3],anslist[-4]]: stop = 1 if getmoney(anslist[-1]) < c: print(anslist[-1]+1) else: print(anslist[-1])