結果
問題 |
No.176 2種類の切手
|
ユーザー |
|
提出日時 | 2015-09-08 17:30:15 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 456 bytes |
コンパイル時間 | 225 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,392 KB |
最終ジャッジ日時 | 2024-10-08 03:33:43 |
合計ジャッジ時間 | 2,166 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 RE * 2 |
other | AC * 11 RE * 18 |
ソースコード
import fractions def solve(A, B, T): if T <= A: return A if T <= B: m = (T - 1) // A return min((m + 1) * A, B) L = A * B // fractions.gcd(A, B) R = T % L record = float('inf') for b in range(0, R + 1, B): r = R - b score = b + ((r - 1) // A + 1) * A if record > score: record = score return record + T - R A, B, T = map(int, input().split()) print(solve(A, B, T))