結果
| 問題 |
No.176 2種類の切手
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 18:58:39 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 93 ms / 1,000 ms |
| コード長 | 703 bytes |
| コンパイル時間 | 171 ms |
| コンパイル使用メモリ | 82,104 KB |
| 実行使用メモリ | 59,816 KB |
| 最終ジャッジ日時 | 2025-03-20 18:59:35 |
| 合計ジャッジ時間 | 2,720 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
A, B, T = map(int, input().split())
import math
min_total = float('inf')
# Consider using only A
num_a = (T + A - 1) // A
min_total = min(min_total, num_a * A)
# Consider using only B
num_b = (T + B - 1) // B
min_total = min(min_total, num_b * B)
# Consider combinations of A and B
max_k = (T + B - 1) // B # Equivalent to ceil(T / B)
# To handle large values, limit the range if necessary
max_k = min(max_k, 10**7) # Safeguard against very large k
for k in range(0, max_k + 1):
remaining = T - k * B
if remaining <= 0:
total = k * B
else:
m = (remaining + A - 1) // A
total = k * B + m * A
if total < min_total:
min_total = total
print(min_total)
lam6er