結果

問題 No.1250 汝は倍数なりや?
ユーザー 遭難者遭難者
提出日時 2020-10-09 23:17:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 638 ms / 1,000 ms
コード長 545 bytes
コンパイル時間 3,571 ms
コンパイル使用メモリ 71,748 KB
実行使用メモリ 65,000 KB
最終ジャッジ日時 2023-09-27 19:41:58
合計ジャッジ時間 15,607 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
55,680 KB
testcase_01 AC 108 ms
55,744 KB
testcase_02 AC 101 ms
56,220 KB
testcase_03 AC 104 ms
55,372 KB
testcase_04 AC 108 ms
55,608 KB
testcase_05 AC 105 ms
55,536 KB
testcase_06 AC 102 ms
55,360 KB
testcase_07 AC 103 ms
55,616 KB
testcase_08 AC 106 ms
55,140 KB
testcase_09 AC 108 ms
55,756 KB
testcase_10 AC 103 ms
55,108 KB
testcase_11 AC 103 ms
55,868 KB
testcase_12 AC 103 ms
55,612 KB
testcase_13 AC 102 ms
55,304 KB
testcase_14 AC 104 ms
56,004 KB
testcase_15 AC 105 ms
55,896 KB
testcase_16 AC 105 ms
55,796 KB
testcase_17 AC 107 ms
56,172 KB
testcase_18 AC 102 ms
55,220 KB
testcase_19 AC 104 ms
55,936 KB
testcase_20 AC 122 ms
55,576 KB
testcase_21 AC 104 ms
55,372 KB
testcase_22 AC 106 ms
55,200 KB
testcase_23 AC 146 ms
56,040 KB
testcase_24 AC 149 ms
56,120 KB
testcase_25 AC 149 ms
55,860 KB
testcase_26 AC 107 ms
55,872 KB
testcase_27 AC 146 ms
56,276 KB
testcase_28 AC 107 ms
55,412 KB
testcase_29 AC 122 ms
55,904 KB
testcase_30 AC 113 ms
55,836 KB
testcase_31 AC 112 ms
55,728 KB
testcase_32 AC 108 ms
55,836 KB
testcase_33 AC 638 ms
65,000 KB
testcase_34 AC 178 ms
58,320 KB
testcase_35 AC 200 ms
59,840 KB
testcase_36 AC 586 ms
62,740 KB
testcase_37 AC 496 ms
61,236 KB
testcase_38 AC 526 ms
61,336 KB
testcase_39 AC 160 ms
58,232 KB
testcase_40 AC 186 ms
59,136 KB
testcase_41 AC 559 ms
61,408 KB
testcase_42 AC 439 ms
62,164 KB
testcase_43 AC 603 ms
63,344 KB
testcase_44 AC 425 ms
62,312 KB
testcase_45 AC 364 ms
61,360 KB
testcase_46 AC 380 ms
61,548 KB
testcase_47 AC 233 ms
59,768 KB
testcase_48 AC 102 ms
55,568 KB
testcase_49 AC 101 ms
55,792 KB
testcase_50 AC 104 ms
55,476 KB
testcase_51 AC 101 ms
53,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next());
		int h = Integer.parseInt(sc.next());
		for(int i = 0 ; h != 1 && i < n ; i++){
			int a = Integer.parseInt(sc.next());
			int p = a , q = h , z = p % q;
			while(z != 0){
				p = q;
				q = z;
				z = p % q;
			}
			h /= q;
		}
		if(h == 1) ou.println("YES");
		else ou.println("NO");
		ou.flush();
		sc.close();
	}
}
0