結果
問題 | No.2725 Coprime Game 2 |
ユーザー |
|
提出日時 | 2024-05-05 20:32:22 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 161 ms / 2,000 ms |
コード長 | 549 bytes |
コンパイル時間 | 4,537 ms |
コンパイル使用メモリ | 262,052 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-27 21:34:43 |
合計ジャッジ時間 | 6,565 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 8 |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; using ll = long long; ll N; void solve(){ if(N==2){ cout<<"P"<<endl; return; } ll x; for(ll i = 2;;i++){ if(N%i){ x = i; break; } } if(gcd(N,x)!=1){ cout<<"P"<<endl; }else{ cout<<"K"<<endl; } } signed main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int T; cin >> T; while (T--) { cin >> N; solve(); } }