結果
| 問題 |
No.915 Plus Or Multiple Operation
|
| コンテスト | |
| ユーザー |
risujiroh
|
| 提出日時 | 2019-10-25 22:05:49 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 584 bytes |
| コンパイル時間 | 1,677 ms |
| コンパイル使用メモリ | 166,128 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-07 03:30:23 |
| 合計ジャッジ時間 | 2,085 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 3 WA * 7 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
int main() {
cin.tie(nullptr); ios::sync_with_stdio(false);
int q; cin >> q;
while (q--) {
lint a, b, c; cin >> a >> b >> c;
if (c == 1) {
cout << -1 << '\n';
continue;
}
lint x = (a + c - 2) / (c - 1);
lint t = 0;
while (a) {
if (a % c) {
a = a / c * c;
++t;
} else {
a /= c;
++t;
}
}
cout << min(t, x) * b << '\n';
}
}
risujiroh