結果
問題 | No.726 Tree Game |
ユーザー |
|
提出日時 | 2018-09-01 15:32:12 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 580 bytes |
コンパイル時間 | 1,476 ms |
コンパイル使用メモリ | 158,456 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-18 21:50:54 |
合計ジャッジ時間 | 1,881 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define int long long bool IsPrimeNumber(int n){ if(n == 2 || n == 3)return true; if(n%2 == 0 || n%3 == 0|| n <= 4) return false; for(int i = 6; (i-1)*(i-1) <= n; i+=6) if(n%(i-1) == 0 || n%(i+1) == 0) return false; return true; } bool hoge(int Y, int X){ int tempa = 0, tempb=0, x=X; while(!IsPrimeNumber(++X)&&!IsPrimeNumber(Y)) tempa++; while(!IsPrimeNumber(++Y)&&!IsPrimeNumber(x)) tempb++; return (tempa+tempb)%2; } signed main(){ int Y, X; cin>>Y>>X; cout<<(hoge(Y,X)?"First":"Second")<<endl; return 0; }