結果

問題 No.915 Plus Or Multiple Operation
ユーザー ntuda
提出日時 2025-01-02 16:13:28
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 318 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 82,708 KB
実行使用メモリ 54,072 KB
最終ジャッジ日時 2025-01-02 16:13:30
合計ジャッジ時間 1,511 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 1 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    a,b,c = map(int,input().split())
    i = 0
    if c == 1:
        print(-1)
        continue
    while a > 0:
        if a < 2 * c - 1:
            a = 0
            i += 1
        if a % c == 0:
            a //= c
        else:
            a -= a % c
        i += 1
    print(b * i)
0