結果

問題 No.915 Plus Or Multiple Operation
コンテスト
ユーザー cureskol
提出日時 2020-04-15 16:30:40
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 314 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,608 ms
コンパイル使用メモリ 184,016 KB
実行使用メモリ 11,428 KB
最終ジャッジ日時 2026-05-07 12:07:33
合計ジャッジ時間 8,744 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other TLE * 1 -- * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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