結果
| 問題 |
No.2724 Coprime Game 1
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-12 22:12:08 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 546 bytes |
| コンパイル時間 | 1,964 ms |
| コンパイル使用メモリ | 193,640 KB |
| 最終ジャッジ日時 | 2025-02-21 00:25:48 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 1 WA * 6 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
constexpr int L = 5000000;
int main () {
bool is_s[L + 1];
is_s[0] = is_s[1] = 0;
for (int i = 2; i <= L; i ++) {
if (is_s[i]) {
for (int j = 2; j * i <= L; j ++) {
is_s[i * j] = false;
}
}
}
int num[L + 1];
num[0] = num[1] = 0;
for (int i = 2; i <= L; i ++) {
num[i] = num[i - 1] + is_s[i];
}
int T;
cin >> T;
while(T--) {
int N;
cin >> N;
if (is_s[N]) {
puts("P");
} else {
int n = N - (num[N] - num[N / 2]);
cout << (n & 1 ? "P" : "K") << endl;
}
}
}