結果
問題 |
No.2725 Coprime Game 2
|
ユーザー |
|
提出日時 | 2025-07-27 15:39:28 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 55 ms / 2,000 ms |
コード長 | 1,301 bytes |
コンパイル時間 | 1,934 ms |
コンパイル使用メモリ | 194,236 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-07-27 15:39:32 |
合計ジャッジ時間 | 3,105 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 8 |
ソースコード
//Date: 2025-07-27 14:32:02 #include <bits/stdc++.h> using namespace std; #define int long long #define P emplace_back #define CLEAR(a, v) memset(a, (v), sizeof(a)) #define pii pair<int, int> #define fi first #define se second #define rep(i, a, b) for(int i = (a); i <= (b); i++) #define per(i, a, b) for(int i = (a); i >= (b); i--) //char buf[1 << 20], *p1, *p2; //#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 20, stdin), p1 == p2) ? EOF : *p1++) inline int rd() { int s = 0, m = 0; char ch = getchar(); while(!isdigit(ch)) {if(ch == '-') m = 1; ch = getchar();} while(isdigit(ch)) s = (s << 3) + (s << 1) + (ch ^ 48), ch = getchar(); return m ? -s : s; } bool MBE; namespace SOLVER { int n, x, y; void MAIN() { n = rd(), x = y = 0; if(n == 2) return puts("P"), void(); for(int i = 2; i <= n && (!x || !y); i++) { if(!x && __gcd(i, n) == 1) x = i; if(!y && n % i) y = i; } if(!x) puts("P"); else puts(x > y ? "P" : "K"); } } bool MED; signed main() { // freopen(".in", "r", stdin); freopen(".out", "w", stdout); // cin.tie(0), cout.tie(0), ios::sync_with_stdio(0); for(int tt = rd(); tt; tt--) SOLVER::MAIN(); cerr << (&MBE - &MED) / 1024 << " KB, " << 1000 * clock() / CLOCKS_PER_SEC << " ms\n"; return 0; }