結果
問題 |
No.915 Plus Or Multiple Operation
|
ユーザー |
|
提出日時 | 2021-11-01 02:58:02 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 463 bytes |
コンパイル時間 | 2,249 ms |
コンパイル使用メモリ | 191,620 KB |
最終ジャッジ日時 | 2025-01-25 10:13:44 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 TLE * 2 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(void) { cin.tie(0); ios::sync_with_stdio(false); long long int a,b,c; int q; cin >> q; while(q--) { long long int res = 0; cin >> a >> b >> c; while(a > 0) { if(a >= c && a < 2*c) { res += b; a-=(c-1); } else { if(a%c!=0) { res += b; a -= (a%c); } else { a/=c; res+=b; } } } cout << res << '\n'; } return 0; }