結果
| 問題 | 
                            No.726 Tree Game
                             | 
                    
| コンテスト | |
| ユーザー | 
                             sumeragifseiei
                         | 
                    
| 提出日時 | 2018-08-24 23:02:39 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 840 bytes | 
| コンパイル時間 | 476 ms | 
| コンパイル使用メモリ | 59,384 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-23 08:59:46 | 
| 合計ジャッジ時間 | 1,289 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 22 WA * 3 | 
ソースコード
#include <iostream>
#include <math.h>
using namespace std;
typedef long long ll;
ll x, y, ans;
int main(void){
    // Your code here!
    cin >> x >> y;
    bool G = true;
    for (ll i = 2; i <= sqrt(x); i++){
        if (x % i == 0) G = false;
    }
    for (ll i = 2; i <= sqrt(y); i++){
        if (y % i == 0) G = false;
    }
    if (G){
        cout << "Second" << endl;
        return 0;
    }
    while(true){
        x++, ans++;
        bool sosu = true;
        for (ll i = 2; i <= sqrt(x); i++){
            if (x % i == 0) sosu = false;
        }
        if (sosu) break;
    }
    while(true){
        y++, ans++;
        bool sosu = true;
        for (ll i = 2; i <= sqrt(y); i++){
            if (y % i == 0) sosu = false;
        }
        if (sosu) break;
    }
    cout << (ans % 2 == 0 ? "Second" : "First") << endl;
}
            
            
            
        
            
sumeragifseiei