結果

問題 No.2725 Coprime Game 2
ユーザー MasKoaTS
提出日時 2023-09-26 15:53:50
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 205 ms / 2,000 ms
コード長 393 bytes
コンパイル時間 1,863 ms
コンパイル使用メモリ 195,508 KB
最終ジャッジ日時 2025-02-17 02:26:20
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;


char solve(ll n) {
	for (ll i = 2; i < n; ++i) {
		if (n % i == 0) {
			continue;
		}
		if (gcd(n, i) == 1) {
			return 'K';
		}
		break;
	}
	return 'P';
}


int main(void) {
	int t;	cin >> t;
	vector<ll> query(t);
	for (auto& n : query) {
		cin >> n;
	}

	for (ll n : query) {
		cout << solve(n) << endl;
	}

	return 0;
}
0