結果
問題 |
No.928 軽減税率?
|
ユーザー |
![]() |
提出日時 | 2020-08-20 21:01:56 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 844 bytes |
コンパイル時間 | 229 ms |
コンパイル使用メモリ | 82,448 KB |
実行使用メモリ | 66,140 KB |
最終ジャッジ日時 | 2024-10-13 18:01:21 |
合計ジャッジ時間 | 3,164 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 11 WA * 21 RE * 2 |
ソースコード
import sys; input = sys.stdin.buffer.readline sys.setrecursionlimit(10**7) from collections import defaultdict con = 10 ** 9 + 7; INF = float("inf") def getlist(): return list(map(int, input().split())) def func(P, Q, A, x): val = int((100 * x + P * x) // 100) - int((100 * x + Q * x) // 100) - A return val def Binary_Search(P, Q, A): #初期化 left = 1 right = 10 ** 9 ans = None #二分探索 while left <= right: x = (left + right) // 2 if func(P, Q, A, x) >= 0: right = x - 1 else: ans = x left = x + 1 return ans #処理内容 def main(): P, Q, A = getlist() ans = Binary_Search(P, Q, A) for i in range(max(1, ans - 1000000), ans): if func(P, Q, A, i) >= 0: ans -= 2 for i in range(ans + 1, ans + 1000000): if func(P, Q, A, i) < 0: ans += 1 print(ans) if __name__ == '__main__': main()