結果

問題 No.915 Plus Or Multiple Operation
ユーザー cureskol
提出日時 2020-04-15 16:31:23
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 373 bytes
コンパイル時間 1,522 ms
コンパイル使用メモリ 167,060 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-07 03:46:40
合計ジャッジ時間 2,062 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define int long long

signed main(){
  int q;cin>>q;
  while(q--){
    int a,b,c;cin>>a>>b>>c;
    if(c==1){
      cout<<a*b<<endl;
      continue;
    }
    int ans=0;
    while(a){
      if(a<c){ans++;break;}
      if(a>c&&a<=2*(c-1)){ans+=2;break;}
      if(a%c)ans++;
      a/=c;ans++;
    }
    cout<<ans*b<<endl;
  }
}
0