結果
| 問題 |
No.2724 Coprime Game 1
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-12 21:43:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 73 ms / 2,000 ms |
| コード長 | 438 bytes |
| コンパイル時間 | 570 ms |
| コンパイル使用メモリ | 63,872 KB |
| 実行使用メモリ | 28,032 KB |
| 最終ジャッジ日時 | 2024-10-02 23:09:41 |
| 合計ジャッジ時間 | 1,675 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 7 |
ソースコード
#include<iostream>
#include<cassert>
using namespace std;
int pf[3<<20];
int cnt[3<<20];
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
for(int i=2;i<3<<20;i++)if(pf[i]==0)
{
for(int j=i+i;j<3<<20;j+=i)pf[j]=i;
}
for(int i=2;i<3<<20;i++)cnt[i]=cnt[i-1]+!pf[i];
int T;cin>>T;
for(;T--;)
{
int N;cin>>N;
if(pf[N]==0)cout<<"P\n";
else
{
int t=N;
t-=cnt[N]-cnt[N/2];
cout<<(t%2?"K\n":"P\n");
}
}
}