結果
問題 | No.915 Plus Or Multiple Operation |
ユーザー | nadare |
提出日時 | 2019-10-25 22:56:00 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 585 bytes |
コンパイル時間 | 83 ms |
コンパイル使用メモリ | 10,932 KB |
実行使用メモリ | 7,960 KB |
最終ジャッジ日時 | 2023-08-07 00:29:05 |
合計ジャッジ時間 | 1,047 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 16 ms
7,752 KB |
testcase_02 | AC | 16 ms
7,832 KB |
testcase_03 | AC | 16 ms
7,780 KB |
testcase_04 | AC | 15 ms
7,960 KB |
testcase_05 | AC | 16 ms
7,832 KB |
testcase_06 | AC | 16 ms
7,804 KB |
testcase_07 | AC | 15 ms
7,808 KB |
testcase_08 | AC | 16 ms
7,776 KB |
testcase_09 | AC | 16 ms
7,792 KB |
testcase_10 | AC | 16 ms
7,832 KB |
testcase_11 | AC | 16 ms
7,816 KB |
testcase_12 | WA | - |
ソースコード
import sys #input = sys.stdin.readline def inpl(): return list(map(int, input().split())) for _ in range(int(input())): a, b, c = inpl() if c == 1: print(a*b) continue Q = [] d = c - 1 hoge = -(-a//(c-1)) ans = 0 # print(a, end = " ") while a: a, m = divmod(a, c) Q.append(m) # print(Q, end = " ") if (len(Q) >= 2) and (Q[-1] == 1) and (1 <= Q[-2] <= c-2): ans += 3 Q.pop() Q.pop() while Q: x = Q.pop() ans += 1 + (x > 0) print(b*min(ans-1, hoge))