結果

問題 No.915 Plus Or Multiple Operation
ユーザー curi_kucuri_ku
提出日時 2019-10-26 00:58:09
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 356 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-07 03:41:02
合計ジャッジ時間 1,093 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

Q = int(input())
for i in range(Q):
  A,B,C = [int(x) for x in input().split()]
  ans = 0
  if C==1:
    print(A*B)
    break
  elif A<C:
    print(B)
    break
  while A>C:
    if A<=2*(C-1):
      ans+=2
      A=1
      break
    if A%C!=0:
      A = A-A%C
      ans+=1
    A = A/C
    ans+=1
  if A==C:
    ans+=2
  elif A!=1:
    ans+=1
  print(ans*B)
0