結果

問題 No.2016 Countdown Divisors
ユーザー shoshoshom
提出日時 2022-07-22 23:12:50
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 607 bytes
コンパイル時間 1,931 ms
コンパイル使用メモリ 193,312 KB
最終ジャッジ日時 2025-01-30 13:01:33
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 1 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

static inline void solution() {
  int TT;
  cin >> TT;
  while (TT--) {
    int n;
    cin >> n;
    if (n == 1 || n == 3) {
      cout << 1 << '\n';
      continue;
    } else if (n == 2) {
      cout << 2 << '\n';
      continue;
    }
    int cur = n;
    int sq_cnt = 0;
    int t = 1;
    while (t <= cur) {
      sq_cnt += 1;
      cur -= t;
      t += 2;
    }
    if (sq_cnt % 2 == n % 2) {
      cout << 2 << '\n';
    } else {
      cout << 1 << '\n';
    }
  }
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  solution();
  return 0;
}
0