結果
| 問題 | No.2724 Coprime Game 1 |
| コンテスト | |
| ユーザー |
nonon
|
| 提出日時 | 2024-04-12 21:52:26 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 46 ms / 2,000 ms |
| コード長 | 608 bytes |
| 記録 | |
| コンパイル時間 | 1,140 ms |
| コンパイル使用メモリ | 217,532 KB |
| 実行使用メモリ | 11,928 KB |
| 最終ジャッジ日時 | 2026-07-04 11:24:16 |
| 合計ジャッジ時間 | 2,182 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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