結果
問題 | No.915 Plus Or Multiple Operation |
ユーザー |
|
提出日時 | 2019-10-25 21:45:39 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 40 ms / 2,000 ms |
コード長 | 337 bytes |
コンパイル時間 | 388 ms |
コンパイル使用メモリ | 82,376 KB |
実行使用メモリ | 53,624 KB |
最終ジャッジ日時 | 2024-11-07 03:24:29 |
合計ジャッジ時間 | 1,324 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
n = int(input()) for i in range(n): a,b,c = map(int,input().split()) if c == 1: print(-1) continue x = 0 y = 10 ** 100 while a > 0: y = min(y, x + b * ((a + c - 2) // (c - 1))) if a % c == 0: a //= c else: a -= a % c x += b print(min(x, y))