結果

問題 No.7 プライムナンバーゲーム
ユーザー Beat7501Beat7501
提出日時 2018-11-17 16:31:18
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 509 bytes
コンパイル時間 3,729 ms
コンパイル使用メモリ 71,376 KB
実行使用メモリ 57,932 KB
最終ジャッジ日時 2023-08-26 01:44:49
合計ジャッジ時間 5,497 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
55,984 KB
testcase_01 AC 103 ms
55,824 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 104 ms
55,868 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 107 ms
56,128 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 108 ms
55,904 KB
testcase_15 AC 109 ms
56,332 KB
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean flag = false;
		for(int i = 2; i < 4; i++){
			if(n-i == 2){
				flag = true;
				break;
			}else if(n-i % 2 == 0){
				continue;
			}else{
				int j = 3;
				while(j <= Math.sqrt(n)){
					if(n-i % j == 0){
						flag = true;
						break;
					}
					j += 2;
				}
			}
		}
		if(flag){
			System.out.print("Win");
		}else{
			System.out.print("Lose");
		}
	}
}
0