結果
| 問題 | No.915 Plus Or Multiple Operation |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-10-25 21:44:27 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 390 bytes |
| 記録 | |
| コンパイル時間 | 263 ms |
| コンパイル使用メモリ | 85,136 KB |
| 実行使用メモリ | 54,484 KB |
| 最終ジャッジ日時 | 2026-05-07 11:34:27 |
| 合計ジャッジ時間 | 2,491 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 4 |
ソースコード
n = int(input())
for i in range(n):
a,b,c = map(int,input().split())
if c == 1:
print(-1)
continue
if c == 2:
print(a * b)
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))