結果

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

ソースコード

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;
    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