結果

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

ソースコード

diff #

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


ll isqrt(ll n){
    ll ok = 0;
    ll ng = inf + 1;
    while(abs(ok - ng) > 1){
        ll mid = (ok + ng) >> 1;
        if(mid * mid <= n){
            ok = mid;
        }
        else{
            ng = mid;
        }
    }
    return ok;
}


int main(){
    int t;  cin >> t;
    for(int i = 0; i < t; ++i){
        ll n;   cin >> n;
        ll k = isqrt(n);
        if(k * k == n){
            cout << 'P' << endl;
        }
        else{
            cout << 'K' << endl;
        }
    }

    return 0;
}
0