結果
問題 | No.726 Tree Game |
ユーザー |
![]() |
提出日時 | 2018-08-24 22:04:59 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,221 bytes |
コンパイル時間 | 576 ms |
コンパイル使用メモリ | 73,396 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-23 07:26:57 |
合計ジャッジ時間 | 1,410 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#include<iostream>#include<vector>#include<algorithm>#include<functional>#include<queue>#include<stack>#include<set>#include<climits>#include<cstdlib>#include<cmath>#include<string>using namespace std;#define INF 1 << 29#define LL long long intLL const MOD = 1000000007;bool sosu(LL n){if(n < 2){return false;}else if(n == 2){return true;}else if(n%2 == 0){return false;}else{for(LL i = 3; i <= n/i; i += 2){if(n%i == 0){return false;}}}return true;}int main(){cin.tie(0);ios::sync_with_stdio(false);LL a,b;cin >> a >> b;LL mova;if(a == 1){mova = 0;}else if(a%2 == 0){mova = 2;}else{mova = 1;}LL movb;if(b == 1){movb = 0;}else if(b%2 == 0){movb = 2;}else{movb = 1;}bool fraga = sosu(a);bool fragb = sosu(b);if((fraga && fragb) || a == 2 || b == 2){cout << "Second" << endl;return 0;}if((mova+movb)%2 == 0){cout << "Second" << endl;}else{cout << "First" << endl;}return 0;}