結果

問題 No.2721 "Don't say N" Game
ユーザー ensembleaverageensembleaverage
提出日時 2024-04-12 21:23:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 2,303 bytes
コンパイル時間 1,800 ms
コンパイル使用メモリ 167,268 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-12 21:23:11
合計ジャッジ時間 2,534 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 3 ms
6,940 KB
testcase_02 AC 4 ms
6,944 KB
testcase_03 AC 3 ms
6,944 KB
testcase_04 AC 3 ms
6,940 KB
testcase_05 AC 4 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"


/*#include "boost/multiprecision/cpp_int.hpp"
namespace mp = boost::multiprecision;
using i128=mp::cpp_int;*/


using namespace std;
using namespace chrono;
typedef long long ll;
typedef int64_t i64;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pllll;
typedef vector<pii> vpii;
typedef vector<vector<pii>> vvpii;
typedef vector<vector<vector<pii>>> vvvpii;
typedef vector<pllll> vpllll;
typedef vector<vector<pllll>> vvpllll;
typedef vector<vector<vector<pllll>>> vvvpllll;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define drep(i,a,n) for(int i=a;i>n;i--)
#define yes(ans) {if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;}
#define Yes(ans) {if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;}
#define YES(ans) {if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;}
#define printv(vec) {rep(first_,0,vec.size()) cout << vec[first_] << ' '; cout << endl;}
#define printvv(vec) {rep(first_,0,vec.size()) {rep(second_,0,vec[first_].size()) cout << vec[first_][second_] << ' '; cout << endl;}; cout<<endl;}
#define iINF 2000000007
#define lINF 10000000000007
#define llINF 9000000000000000007
#define all(x) x.begin(),x.end()
#define so(x) sort(all(x))
#define re(x) reverse(all(x))
#define mod 998244353
const double PI = acos(-1);

template <typename T>
vector<pair<T,T>> bunkai(T a){
   vector<pair<T,T>> nini(0);
   T y=a;
   for(T i=2;i*i<=y;i++){
       T count=0;
       while(1){
           if(a%i!=0) break;
           else{
               count++;
               a/=i;
           }
       }
       if(count!=0) nini.push_back({i,count});
   }
   if(a!=1) nini.push_back({a,1});
   return nini;
}

void solve(){
    int n; cin>>n;
    vpii ans=bunkai<int>(n);
    int si=ans.size();
    
    int cnt=1;
    rep(i,0,si){
        cnt*=ans[i].second+1;
    }
    if(cnt%2==0){
        cout<<'K'<<endl;
    }
    else{
        cout<<'P'<<endl;
    }
    return;
}

int main(){
    int t; cin>>t;
    rep(i,0,t){
        solve();
    }
}
0