結果
問題 |
No.897 compαctree
|
ユーザー |
|
提出日時 | 2019-10-04 22:06:31 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,368 bytes |
コンパイル時間 | 1,656 ms |
コンパイル使用メモリ | 138,584 KB |
最終ジャッジ日時 | 2025-01-07 20:33:29 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 10 TLE * 3 |
ソースコード
//include //------------------------------------------ #include <vector> #include <list> #include <map> #include <unordered_map> #include <climits> #include <set> #include <unordered_set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> #include <queue> #include <random> #include <complex> #include <regex> #include <locale> #include <random> #include <type_traits> using namespace std; #define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";} #define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}} using LL = long long; //------------------------------------------ //------------------------------------------ typedef __int128 Lint; Lint toLint(const string s) { Lint ret = 0; for (int i = 0; i < s.length(); i++) if ('0' <= s[i] && s[i] <= '9') ret = 10 * ret + s[i] - '0'; return ret; } ostream &operator<<(ostream &dest, __int128_t value) { ostream::sentry s(dest); if (s) { __uint128_t tmp = value < 0 ? -value : value; char buffer[128]; char *d = std::end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = std::end(buffer) - d; if (dest.rdbuf()->sputn(d, len) != len) { dest.setstate(ios_base::badbit); } } return dest; } istream &operator>>(istream &in, Lint &d) { string s; cin >> s; Lint tmp = 0; for (int i = 0; i < s.length(); i++)if ('0' <= s[i] && s[i] <= '9')tmp = 10 * tmp + s[i] - '0'; d = tmp; return in; } int main() { LL Q; cin >> Q; while (Q--) { Lint N, K; cin >> N >> K; Lint d = 0; Lint sum = 1; Lint b = 1; while (sum < N) { d++; b *= K; sum += b; } cout << d << endl; } return 0; }