結果
| 問題 |
No.915 Plus Or Multiple Operation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-01-12 22:33:09 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 807 bytes |
| コンパイル時間 | 728 ms |
| コンパイル使用メモリ | 93,288 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-21 12:11:33 |
| 合計ジャッジ時間 | 1,372 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 WA * 5 |
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
int q;
cin >> q;
for (int i = 0; i < q; i++) {
long long a, b, c;
cin >> a >> b >> c;
if (c == 1) {
cout << "-1" << endl;
continue;
}
long long co = 0;
if (a % c == 0) {
a /= c;
co++;
}
while (a > 0) {
co++;
if (a < c && a == 1) {
co--;
}
a /= c;
co++;
}
cout << b * (co-1) << endl;
}
}