結果

問題 No.897 compαctree
ユーザー tnakao0123
提出日時 2019-10-05 00:37:38
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 754 bytes
コンパイル時間 689 ms
コンパイル使用メモリ 84,068 KB
実行使用メモリ 13,636 KB
最終ジャッジ日時 2024-10-04 00:50:18
合計ジャッジ時間 4,257 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10 TLE * 1 -- * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:41:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   41 |   scanf("%d", &q);
      |   ~~~~~^~~~~~~~~~
main.cpp:45:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   45 |     scanf("%d%d", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 897.cc:  No.897 comp留ctree - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

typedef long long ll;

/* global variables */

/* subroutines */

/* main */

int main() {
  int q;
  scanf("%d", &q);

  while (q--) {
    int n, k;
    scanf("%d%d", &n, &k);

    int d = 0;
    ll e = 1;
    while (n > e) {
      d++;
      n -= e;
      e *= k;
    }

    printf("%d\n", d);
  }
  return 0;
}
0