結果
問題 |
No.726 Tree Game
|
ユーザー |
|
提出日時 | 2018-09-17 14:24:06 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,182 bytes |
コンパイル時間 | 1,007 ms |
コンパイル使用メモリ | 114,384 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-18 07:39:47 |
合計ジャッジ時間 | 1,819 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 WA * 2 |
ソースコード
#define _USE_MATH_DEFINES #include <cstdio> #include <iostream> #include <sstream> #include <fstream> #include <iomanip> #include <algorithm> #include <cmath> #include <complex> #include <string> #include <vector> #include <array> #include <list> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <numeric> #include <limits> #include <climits> #include <cfloat> #include <functional> #include <iterator> #include <memory> #include <regex> using namespace std; bool primalityTest(long long n) { if(n < 2) return false; for(long long i=2; i*i<=n; ++i){ if(n % i == 0) return false; } return true; } int main() { int y, x; cin >> y >> x; if((y == 2 && x == 3) || (y == 3 || x == 2)){ cout << "Second" << endl; return 0; } if(primalityTest(y) && primalityTest(x)){ cout << "Second" << endl; return 0; } int i = 1; int j = 1; while(!primalityTest(y+i)) ++ i; while(!primalityTest(x+j)) ++ j; if((i + j) % 2 == 0) cout << "Second" << endl; else cout << "First" << endl; return 0; }