結果
問題 | No.2725 Coprime Game 2 |
ユーザー |
![]() |
提出日時 | 2024-04-12 22:36:29 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 410 bytes |
コンパイル時間 | 687 ms |
コンパイル使用メモリ | 79,656 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-02 23:32:46 |
合計ジャッジ時間 | 1,536 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 8 |
ソースコード
#include <iostream>#include <numeric>using namespace std;using lint = long long;bool solve(lint N) {lint m = 2;while (N % m == 0) ++m;if (m >= N) return false;return std::gcd(m, N) == 1;}int main() {cin.tie(nullptr)->sync_with_stdio(false);int T;cin >> T;while (T--) {lint N;cin >> N;cout << (solve(N) ? "K" : "P") << '\n';}}