結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rev(i, n) for (int i = (n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
void YesNo(bool f) {cout << (f ? "Yes\n" : "No\n");};

void fast_io() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
}

void solve() {
    int N;
    cin >> N;
    unordered_set<int> st;
    for (int i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            st.insert(i);
            st.insert(N / i);
        }
    }
    cout << (st.size() & 1 ? "P" : "K") << endl; 
}

signed main(void) {
    fast_io();
    int T;
    cin >> T;
    while (T--) solve();
    return 0;
}
0