結果

問題 No.1651 Removing Cards
ユーザー 👑 hos.lyric
提出日時 2021-07-25 13:41:19
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 1,284 bytes
コンパイル時間 2,810 ms
コンパイル使用メモリ 138,636 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2024-10-14 02:18:25
合計ジャッジ時間 8,451 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 TLE * 1 -- * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }



int main() {
  int K, Q;
  scanf("%d%d", &K, &Q);
  --K;
  
  for (; Q--; ) {
    Int N;
    scanf("%lld", &N);
    
    Int x = 0;
    for (; ; ) {
      const Int xx = x + x / K + 1;
      if (xx >= N) {
        break;
      }
      x = xx;
    }
    printf("%lld\n", x + 1);
  }
  return 0;
}
0