結果

問題 No.915 Plus Or Multiple Operation
ユーザー titia
提出日時 2019-10-25 21:36:33
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 322 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 81,828 KB
実行使用メモリ 71,696 KB
最終ジャッジ日時 2024-11-07 03:22:03
合計ジャッジ時間 6,548 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other TLE * 1 -- * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

Q=int(input())

for testcases in range(Q):
    A,B,C=map(int,input().split())

    count=0
    while A>(C-1)*2:
        if A%C==0:
            A//=C
            count+=1

        else:
            A=A//C*C
            count+=1

        #print(A)

    if A<C:
        count+=1
    else:
        count+=2

    print(count*B)
0