結果

問題 No.726 Tree Game
ユーザー ldsyb
提出日時 2018-08-25 12:01:34
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 491 bytes
コンパイル時間 1,650 ms
コンパイル使用メモリ 166,324 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-25 06:40:57
合計ジャッジ時間 2,564 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main()
{
	auto is_prime = [](int64_t n) {
		for (int64_t i = 2; i * i <= n; i++)
		{
			if (n % i == 0)
			{
				return false;
			}
		}
		return true;
	};
	int64_t x, y;
	cin >> x >> y;
	int64_t xp = x, yp = y;
	while (!is_prime(xp))
	{
		xp++;
	}
	while (!is_prime(yp))
	{
		yp++;
	}
	if ((xp == x) || (yp == y))
	{
		cout << "First" << endl;
		return 0;
	}
	cout << ((((xp - x) + (yp - y)) % 2) ? "First" : "Second") << endl;
	return 0;
}
0