結果
| 問題 | No.915 Plus Or Multiple Operation |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-05-22 22:51:23 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 25 ms / 2,000 ms |
| + 264µs | |
| コード長 | 320 bytes |
| 記録 | |
| コンパイル時間 | 63 ms |
| コンパイル使用メモリ | 81,780 KB |
| 実行使用メモリ | 55,640 KB |
| 最終ジャッジ日時 | 2026-10-01 16:51:18 |
| 合計ジャッジ時間 | 1,978 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
for _ in range(int(input())):
a,b,c=map(int,input().split())
if c==1:
print(-1)
continue
ans=0
k=a
x=[]
while a:
if a%c:
ans+=b
x.append(a%c)
a//=c
if a:
ans+=b
x.reverse()
if len(x)>=2 and x[0]==1 and 0<x[1]<c-1:
ans-=b
print(ans)