結果

問題 No.2721 "Don't say N" Game
ユーザー haihamabossu
提出日時 2024-04-12 21:32:02
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 592 bytes
コンパイル時間 1,941 ms
コンパイル使用メモリ 192,864 KB
最終ジャッジ日時 2025-02-21 00:07:53
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

ll cnt[1010];

void precalc() {
  for (ll i = 1; i <= 1000; i++) {
    for (ll j = 1; j * j <= i; j++) {
      if (i % j)
        continue;
      cnt[i]++;
      if (i / j != j)
        cnt[i]++;
    }
  }
}

void solve() {
  ll n;
  cin >> n;
  cout << (cnt[n] % 2 ? 'P' : 'K') << '\n';
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  int T = 1;
  cin >> T;
  precalc();
  for (int t = 0; t < T; t++) {
    solve();
  }
  return 0;
}
0