結果

問題 No.915 Plus Or Multiple Operation
ユーザー simamumusimamumu
提出日時 2019-10-25 22:27:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 609 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 70,016 KB
最終ジャッジ日時 2024-04-24 18:44:13
合計ジャッジ時間 1,918 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 71 ms
69,248 KB
testcase_04 AC 70 ms
69,248 KB
testcase_05 AC 72 ms
69,376 KB
testcase_06 AC 70 ms
69,504 KB
testcase_07 AC 71 ms
69,120 KB
testcase_08 WA -
testcase_09 AC 70 ms
69,120 KB
testcase_10 AC 72 ms
69,248 KB
testcase_11 AC 71 ms
69,376 KB
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

Q = inp()

for q in range(Q):
    A,B,C = inpl()
    if C == 1:
        print(A*B)
    else:
        ans = 0
        while A > 1:
            if A%C == 0:
                A //= C
            else:
                A -= A%C
            ans += B
        print(ans)
0