結果
問題 |
No.897 compαctree
|
ユーザー |
|
提出日時 | 2023-06-13 16:14:03 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 518 bytes |
コンパイル時間 | 1,622 ms |
コンパイル使用メモリ | 169,616 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-22 01:27:51 |
合計ジャッジ時間 | 1,947 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; int main() { int Q; cin >> Q; vector<pair<int,int>> NK(Q); for(int i = 0; i < Q; i++) { int a,b; cin >>a >> b; NK[i] = {a,b}; } for(int i = 0; i < Q; i++) { int x = NK[i].first; int y = NK[i].second; if(y == 1) { cout << x- 1 << endl; continue; } int ans = 0; while(true) { if(x == 0) break; x /= y; ans++; } cout <<ans << endl; } }