結果
| 問題 |
No.915 Plus Or Multiple Operation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-06 23:34:15 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 462 bytes |
| コンパイル時間 | 2,675 ms |
| コンパイル使用メモリ | 191,704 KB |
| 最終ジャッジ日時 | 2025-01-10 07:20:58 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 6 WA * 2 TLE * 2 |
ソースコード
typedef long long ll;
typedef long double ld;
#include <bits/stdc++.h>
using namespace std;
int main() {
ll q;
std::cin >> q;
for (int i = 0; i < q; i++) {
ll a,b,c;
std::cin >> a>>b>>c;
ll cnt = 0;
while(a%c>0||a/c>0){
if(a%c!=0)cnt++;
if(a/c!=0)cnt++;
if(a%c!=0&&a%c<=c-2&&a/c%c==1)cnt--;
a/=c;
}
std::cout << cnt*b << std::endl;
}
}