結果

問題 No.2725 Coprime Game 2
ユーザー ttkkggww
提出日時 2024-05-05 20:32:22
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 549 bytes
コンパイル時間 3,987 ms
コンパイル使用メモリ 250,340 KB
最終ジャッジ日時 2025-02-21 11:05:15
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

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

void solve(){
    if(N==2){
        cout<<"P"<<endl;
        return;
    }
    ll x;
    for(ll i = 2;;i++){
        if(N%i){
            x = i;
            break;
        }
    }
    if(gcd(N,x)!=1){
        cout<<"P"<<endl;
    }else{
        cout<<"K"<<endl;
    }
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T;
    cin >> T;
    while (T--) {
        cin >> N;
        solve();
    }
}
0