結果

問題 No.928 軽減税率?
ユーザー maspy
提出日時 2020-02-05 22:40:11
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 31 ms / 1,000 ms
コード長 586 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-09-23 05:24:28
合計ジャッジ時間 2,165 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

P, Q, A = map(int, read().split())

def F(a, b, U=10**7):
    """count 0 <= n < U such that an + b > 0"""
    if a == 0:
        return U if b > 0 else 0
    if a < 0:
        return U - F(-a, -b+1, U)
    low = ((-b) // a) + 1
    if low < 0:
        low = 0
    return max(0, U - low)

answer = 0
for x in range(1, 101):
    eat_in = (100 + P) * x // 100
    take_out = (100 + Q) * x // 100 + A
    coef = Q - P
    answer += F(coef, take_out - eat_in)

print(answer)
0