結果
| 問題 |
No.915 Plus Or Multiple Operation
|
| コンテスト | |
| ユーザー |
koi_kotya
|
| 提出日時 | 2019-10-25 23:48:42 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 949 bytes |
| コンパイル時間 | 1,476 ms |
| コンパイル使用メモリ | 166,872 KB |
| 実行使用メモリ | 16,840 KB |
| 最終ジャッジ日時 | 2024-11-07 03:40:13 |
| 合計ジャッジ時間 | 7,890 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | TLE * 1 -- * 9 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)
int main() {
int q;
cin >> q;
for (int z = 0;z < q;++z) {
ll a,b,c;
cin >> a >> b >> c;
int ans = 0;
while (a) {
if (a%c) ans++;
if ((a/c/c)%c == 1 && (a/c)%c < c-1) {
ans += 4;
a /= c;
a /= c;
a /= c;
} else {
a /= c;
ans++;
}
}
cout << ans << endl;
cout << (ans-1)*b << endl;
}
}
koi_kotya