結果
問題 | No.897 compαctree |
ユーザー |
![]() |
提出日時 | 2019-11-06 13:55:15 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 15 ms / 2,000 ms |
コード長 | 398 bytes |
コンパイル時間 | 2,073 ms |
コンパイル使用メモリ | 195,624 KB |
最終ジャッジ日時 | 2025-01-08 02:21:30 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 13 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 6 | main(){ | ^~~~
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for(ll i=0;i<(n);++i) main(){ ll q; cin>>q; vector<ll> n(q),k(q); rep(i,q)cin>>n[i]>>k[i]; auto solve = [](ll n,ll k){ if(k==1)return n-1; n--; ll cnt=0,leaf=1; while(leaf<n){ cnt++; leaf*=k; } return cnt; }; rep(i,q){ cout<<(solve(n[i],k[i]))<<endl; } }