結果

問題 No.1250 汝は倍数なりや?
ユーザー tentententen
提出日時 2020-10-10 06:08:54
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 495 bytes
コンパイル時間 2,039 ms
コンパイル使用メモリ 71,512 KB
実行使用メモリ 65,116 KB
最終ジャッジ日時 2023-09-27 21:04:54
合計ジャッジ時間 15,646 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
56,048 KB
testcase_01 AC 120 ms
56,224 KB
testcase_02 AC 118 ms
55,972 KB
testcase_03 AC 117 ms
56,032 KB
testcase_04 AC 114 ms
56,076 KB
testcase_05 AC 114 ms
55,616 KB
testcase_06 AC 117 ms
55,880 KB
testcase_07 AC 119 ms
57,764 KB
testcase_08 AC 115 ms
55,732 KB
testcase_09 AC 115 ms
56,112 KB
testcase_10 AC 113 ms
55,880 KB
testcase_11 AC 115 ms
55,872 KB
testcase_12 AC 117 ms
56,108 KB
testcase_13 AC 113 ms
56,332 KB
testcase_14 AC 118 ms
56,032 KB
testcase_15 AC 117 ms
56,036 KB
testcase_16 AC 114 ms
56,208 KB
testcase_17 AC 117 ms
55,524 KB
testcase_18 AC 118 ms
55,884 KB
testcase_19 AC 118 ms
56,016 KB
testcase_20 AC 114 ms
56,192 KB
testcase_21 RE -
testcase_22 AC 119 ms
56,236 KB
testcase_23 AC 176 ms
56,152 KB
testcase_24 AC 165 ms
56,376 KB
testcase_25 AC 175 ms
56,060 KB
testcase_26 AC 120 ms
56,104 KB
testcase_27 AC 173 ms
56,392 KB
testcase_28 AC 121 ms
55,780 KB
testcase_29 AC 137 ms
56,232 KB
testcase_30 AC 130 ms
56,068 KB
testcase_31 AC 126 ms
55,792 KB
testcase_32 AC 122 ms
55,464 KB
testcase_33 AC 752 ms
64,704 KB
testcase_34 AC 220 ms
59,164 KB
testcase_35 AC 254 ms
60,148 KB
testcase_36 AC 667 ms
64,676 KB
testcase_37 AC 570 ms
61,900 KB
testcase_38 AC 592 ms
62,040 KB
testcase_39 AC 206 ms
59,076 KB
testcase_40 AC 231 ms
59,456 KB
testcase_41 AC 629 ms
65,116 KB
testcase_42 AC 514 ms
60,660 KB
testcase_43 AC 730 ms
64,736 KB
testcase_44 AC 544 ms
60,908 KB
testcase_45 AC 473 ms
60,952 KB
testcase_46 AC 446 ms
61,048 KB
testcase_47 AC 321 ms
60,472 KB
testcase_48 AC 115 ms
56,200 KB
testcase_49 AC 116 ms
55,936 KB
testcase_50 AC 121 ms
55,524 KB
testcase_51 AC 121 ms
55,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int h = sc.nextInt();
		while (0 < n-- && h > 1) {
		    h /= getGCD(h, Math.abs(sc.nextInt()));
		    
		}
		if (h == 1) {
		    System.out.println("YES");
		} else {
		    System.out.println("NO");
		}
	}
	
	static int getGCD(int x, int y) {
	    if (x % y == 0) {
	        return y;
	    } else {
	        return getGCD(y, x % y);
	    }
	}
}
0