結果

問題 No.2725 Coprime Game 2
ユーザー MasKoaTS
提出日時 2023-09-29 10:32:14
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 184 ms / 2,000 ms
コード長 472 bytes
コンパイル時間 1,603 ms
コンパイル使用メモリ 195,904 KB
最終ジャッジ日時 2025-02-17 02:53:52
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

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


char solve(ll n){
    for(ll i = 2; i < n; ++i){
        if(n % i == 0){
            continue;
        }
        if(gcd(n, i) == 1){
            return 'K';
        }
        break;
    }
    return 'P';
}


int main(void){
    int t;  cin >> t;
    vector<ll> query(t);
    for(auto& n : query){
        cin >> n;
    }

    for(ll n : query){
        cout << solve(n) << endl;
    }

    return 0;
}
0