結果
| 問題 |
No.928 軽減税率?
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-31 17:56:47 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 35 ms / 1,000 ms |
| コード長 | 1,424 bytes |
| コンパイル時間 | 130 ms |
| コンパイル使用メモリ | 82,408 KB |
| 実行使用メモリ | 54,104 KB |
| 最終ジャッジ日時 | 2025-03-31 17:58:01 |
| 合計ジャッジ時間 | 2,406 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 34 |
ソースコード
P, Q, A = map(int, input().split())
if P == Q:
if A > 0:
print(1000000000)
else:
print(0)
else:
total = 0
d = P - Q
for k in range(100):
x_mod = k
X = (P * x_mod) % 100
Y = (Q * x_mod) % 100
if d > 0:
S = 100 * A - d * x_mod + (X - Y)
denominator = 100 * d
if denominator == 0:
continue # should not happen since d is checked
m_max_candidate = (S - 1) // denominator
m_min = 1 if x_mod == 0 else 0
m_max_x = (10**9 - x_mod) // 100
m_max = min(m_max_candidate, m_max_x)
if m_max >= m_min:
count = m_max - m_min + 1
total += max(count, 0)
else:
# d is negative
T = 100 * A - d * x_mod + (X - Y)
denominator = 100 * d # which is negative
if denominator == 0:
continue # impossible as d is checked
m_min_candidate = T // denominator + 1
m_min_condition = 1 if x_mod == 0 else 0
m_min = max(m_min_candidate, m_min_condition)
m_max_x = (10**9 - x_mod) // 100
if m_min > m_max_x:
continue
else:
count = m_max_x - m_min + 1
total += max(count, 0)
print(total)
lam6er