結果

問題 No.3023 素数判定するだけ
ユーザー shinwisteriashinwisteria
提出日時 2017-03-31 23:09:08
言語 Java19
(openjdk 21)
結果
AC  
実行時間 129 ms / 1,000 ms
コード長 548 bytes
コンパイル時間 3,215 ms
コンパイル使用メモリ 72,848 KB
実行使用メモリ 56,268 KB
最終ジャッジ日時 2023-07-27 19:41:31
合計ジャッジ時間 10,117 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,928 KB
testcase_01 AC 125 ms
56,064 KB
testcase_02 AC 122 ms
55,800 KB
testcase_03 AC 119 ms
55,812 KB
testcase_04 AC 118 ms
55,428 KB
testcase_05 AC 124 ms
55,612 KB
testcase_06 AC 124 ms
56,012 KB
testcase_07 AC 125 ms
56,268 KB
testcase_08 AC 124 ms
55,924 KB
testcase_09 AC 119 ms
56,028 KB
testcase_10 AC 122 ms
56,068 KB
testcase_11 AC 123 ms
55,652 KB
testcase_12 AC 120 ms
55,900 KB
testcase_13 AC 126 ms
55,692 KB
testcase_14 AC 122 ms
55,648 KB
testcase_15 AC 124 ms
55,812 KB
testcase_16 AC 129 ms
56,072 KB
testcase_17 AC 125 ms
55,384 KB
testcase_18 AC 124 ms
55,744 KB
testcase_19 AC 123 ms
55,864 KB
testcase_20 AC 127 ms
55,988 KB
testcase_21 AC 124 ms
55,600 KB
testcase_22 AC 126 ms
56,028 KB
testcase_23 AC 125 ms
55,952 KB
testcase_24 AC 127 ms
55,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Scanner;

public class SosuHantei {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int N = s.nextInt();
		s.close();
		String str = "abcdefg";
		String yn = "YES";
		ArrayList<Integer> list = new ArrayList<>();
		list.add(N);
		list.add(str.length());
		if(N == str.indexOf("b")){
			yn = "NO";
		}

		while(list.size() < N){
			int i = list.size();
			if(N % i == str.indexOf("a")){
				yn = "NO";
				break;
			}
			list.add(i);
		}
		System.out.println(yn);

	}

}
0