結果
| 問題 | No.726 Tree Game |
| コンテスト | |
| ユーザー |
YamaKasa
|
| 提出日時 | 2018-08-24 21:43:06 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 735 bytes |
| 記録 | |
| コンパイル時間 | 1,716 ms |
| コンパイル使用メモリ | 82,496 KB |
| 実行使用メモリ | 46,892 KB |
| 最終ジャッジ日時 | 2026-03-07 22:31:52 |
| 合計ジャッジ時間 | 3,953 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 WA * 2 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int Y = scan.nextInt();
int X = scan.nextInt();
scan.close();
int pX = X + 1;
int pY = Y + 1;
while(!isPrime(pX)) {
pX ++;
}
while(!isPrime(pY)) {
pY ++;
}
int k = pX - X + pY - Y - 2;
if(k % 2 == 0) {
System.out.println("Second");
}else {
System.out.println("First");
}
}
public static boolean isPrime(long n) {
if(n < 2) return false;
if(n == 2) return true;
if(n % 2 == 0) return false;
for(long i = 3; i <= (int)Math.sqrt(n); i += 2){
if(n % i == 0) {
return false;
}
}
return true;
}
}
YamaKasa