結果

問題 No.2725 Coprime Game 2
ユーザー aki
提出日時 2024-11-08 13:53:51
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 751 bytes
コンパイル時間 2,056 ms
コンパイル使用メモリ 192,876 KB
最終ジャッジ日時 2025-02-25 02:33:57
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 2 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        if(n==2){
            cout << "P" << endl;
            continue;
        }
        
        ll x = n;
        for(int i=2;i<=100;i++){
            if(x%i==0){
                while(x%i==0){
                    x/=i;
                }
            }
            else{
                if(gcd(n,i)==1){
                    cout << "K" << endl;
                }
                else{
                    cout << "P" << endl;
                }
                break;
            }
        }
    }
}
0