結果
問題 |
No.915 Plus Or Multiple Operation
|
ユーザー |
![]() |
提出日時 | 2019-10-25 21:29:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 600 bytes |
コンパイル時間 | 1,518 ms |
コンパイル使用メモリ | 165,404 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-07 03:20:51 |
合計ジャッジ時間 | 2,106 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 1 WA * 9 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define all(x) (x).begin(),(x).end() const int mod=1000000007,MAX=100003,INF=1<<30; int main(){ int Q;cin>>Q; while(Q){ ll A,B,C;cin>>A>>B>>C; if(C==1){ cout<<A*B<<endl; }else{ ll cnt=0; while(A){ if(A%C){ A-=A%C; cnt++; }else{ A/=C; cnt++; } } cout<<B*cnt<<endl; } Q--; } }