結果
| 問題 |
No.897 compαctree
|
| コンテスト | |
| ユーザー |
chacoder1
|
| 提出日時 | 2021-01-09 18:54:16 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 324 bytes |
| コンパイル時間 | 2,181 ms |
| コンパイル使用メモリ | 191,296 KB |
| 最終ジャッジ日時 | 2025-01-17 15:49:33 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 3 WA * 10 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int Q;
cin>>Q;
for(int i=0;i<Q;i++){
int n,k;
cin>>n>>k;
if(k==1){
cout<<n-1<<endl;
continue;
}
int cnt=0;
int temp=k;
while(n>=0){
n-=temp;
temp*=k;
cnt++;
}
cout<<cnt<<endl;
}
return 0;
}
chacoder1