結果

問題 No.915 Plus Or Multiple Operation
ユーザー sasa8uyauya
提出日時 2025-03-06 08:41:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 276 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 82,708 KB
実行使用メモリ 54,204 KB
最終ジャッジ日時 2025-03-06 08:41:55
合計ジャッジ時間 1,734 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 1 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(input())
for _ in range(T):
  a,b,c=map(int,input().split())
  if c==1:
    print(-1)
    continue
  if a<c:
    print(b)
    continue
  d=[]
  while a>0:
    d+=[a%c]
    a//=c
  print(d)
  print((len(d)-1+len(d)-d.count(0)-(d[-1]==1 and d[-2]!=0 and c>2)+(d[0]!=0))*b)
0