結果
| 問題 |
No.2724 Coprime Game 1
|
| コンテスト | |
| ユーザー |
nonon
|
| 提出日時 | 2024-04-12 21:52:26 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 82 ms / 2,000 ms |
| コード長 | 608 bytes |
| コンパイル時間 | 1,983 ms |
| コンパイル使用メモリ | 196,588 KB |
| 最終ジャッジ日時 | 2025-02-21 00:17:24 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 7 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
vector<int>P;
vector<bool>ett(1<<22,1);
ett[0]=ett[1]=0;
for(int i=2;i<(1<<22);i++)if(ett[i])
{
P.push_back(i);
for(int j=i+i;j<(1<<22);j+=i)ett[j]=0;
}
int T;
cin>>T;
while(T--)
{
int N;
cin>>N;
if(ett[N])
{
cout<<'P'<<'\n';
continue;
}
int n=lower_bound(P.begin(),P.end(),N)-lower_bound(P.begin(),P.end(),N/2+1);
cout<<((N-n-1)%2==1?'P':'K')<<'\n';
}
}
nonon