結果
問題 |
No.915 Plus Or Multiple Operation
|
ユーザー |
![]() |
提出日時 | 2019-10-25 21:32:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 599 bytes |
コンパイル時間 | 1,709 ms |
コンパイル使用メモリ | 167,588 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-07 03:20:57 |
合計ジャッジ時間 | 2,077 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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<<-1<<endl; }else{ ll cnt=0; while(A){ if(A%C){ A-=A%C; cnt++; }else{ A/=C; cnt++; } } cout<<B*cnt<<endl; } Q--; } }