結果

問題 No.3023 素数判定するだけ
ユーザー shinwisteriashinwisteria
提出日時 2017-03-31 23:09:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 1,000 ms
コード長 548 bytes
コンパイル時間 4,296 ms
コンパイル使用メモリ 76,344 KB
実行使用メモリ 54,556 KB
最終ジャッジ日時 2024-04-15 06:28:41
合計ジャッジ時間 9,285 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
54,136 KB
testcase_01 AC 127 ms
54,248 KB
testcase_02 AC 123 ms
54,268 KB
testcase_03 AC 110 ms
53,248 KB
testcase_04 AC 117 ms
53,984 KB
testcase_05 AC 108 ms
53,076 KB
testcase_06 AC 119 ms
54,232 KB
testcase_07 AC 110 ms
52,984 KB
testcase_08 AC 122 ms
54,304 KB
testcase_09 AC 119 ms
54,324 KB
testcase_10 AC 119 ms
53,872 KB
testcase_11 AC 118 ms
54,260 KB
testcase_12 AC 121 ms
54,176 KB
testcase_13 AC 123 ms
53,792 KB
testcase_14 AC 117 ms
54,204 KB
testcase_15 AC 117 ms
54,088 KB
testcase_16 AC 107 ms
52,712 KB
testcase_17 AC 106 ms
52,832 KB
testcase_18 AC 118 ms
53,936 KB
testcase_19 AC 107 ms
52,720 KB
testcase_20 AC 120 ms
54,148 KB
testcase_21 AC 119 ms
54,556 KB
testcase_22 AC 117 ms
54,080 KB
testcase_23 AC 118 ms
53,976 KB
testcase_24 AC 120 ms
54,168 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