結果
| 問題 |
No.915 Plus Or Multiple Operation
|
| ユーザー |
ei13337
|
| 提出日時 | 2019-10-25 21:49:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 516 bytes |
| コンパイル時間 | 1,650 ms |
| コンパイル使用メモリ | 166,968 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-07 03:25:44 |
| 合計ジャッジ時間 | 2,276 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 6 WA * 4 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main() {
int q;
cin >> q;
rep(query, q) {
ll a, b, c;
cin >> a >> b >> c;
if(c == 1) {
cout << -1 << endl;
continue;
}
ll ans = 0;
while(a > 1) {
if(a % c) ans++;
a /= c;
if(a) ans++;
}
cout << ans * b << endl;
}
return 0;
}
ei13337