結果
問題 |
No.726 Tree Game
|
ユーザー |
![]() |
提出日時 | 2018-09-09 19:10:31 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,445 bytes |
コンパイル時間 | 1,489 ms |
コンパイル使用メモリ | 166,952 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 23:49:09 |
合計ジャッジ時間 | 2,228 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#include <bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<(b);++i) #define erep(i,a,b) for(int i=a;i<=(int)(b);++i) #define per(i,a,b) for(int i=(a);i>(b);--i) #define eper(i,a,b) for(int i=(a);i>=b;--i) #define pb push_back #define mp make_pair #define INF (1<<30)-1 #define MOD 1000000007 #define all(x) (x).begin(),(x).end() #define vii vector<int> #define vll vector<long long> using namespace std; typedef long long ll; typedef pair<int,int> Pii; template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; } int dy[]={0, 0, 1, -1}; int dx[]={1, -1, 0, 0}; int gcd(int a,int b){return b?gcd(b,a%b):a;} int lcm(int a,int b){return a/gcd(a, b)*b;} bool isPrime(ll x) { if (x < 2) return false; else if (x == 2) return true; else if (x % 2 == 0) return false; double sq = sqrt(x); for (int i = 3; i <= sq; i += 2) { if (x % i == 0) { return false; } } return true; } ll X, Y; string ans; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> Y >> X; if ((isPrime(Y) && isPrime(X)) || (X == 2 || Y == 2)) { cout << "Second" << endl; return 0; } if (X == 1) X++; if (Y == 1) Y++; if ((X + Y) % 2) ans = "First"; else ans = "Second"; cout << ans << endl; return 0; }