結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー ks2mks2m
提出日時 2021-10-29 21:30:12
言語 Java19
(openjdk 21)
結果
AC  
実行時間 174 ms / 2,000 ms
コード長 1,012 bytes
コンパイル時間 2,420 ms
コンパイル使用メモリ 76,392 KB
実行使用メモリ 56,584 KB
最終ジャッジ日時 2023-07-29 07:07:47
合計ジャッジ時間 11,466 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
56,204 KB
testcase_01 AC 125 ms
55,796 KB
testcase_02 AC 124 ms
55,916 KB
testcase_03 AC 126 ms
55,376 KB
testcase_04 AC 141 ms
55,916 KB
testcase_05 AC 133 ms
55,928 KB
testcase_06 AC 127 ms
55,720 KB
testcase_07 AC 125 ms
53,968 KB
testcase_08 AC 163 ms
56,136 KB
testcase_09 AC 126 ms
55,664 KB
testcase_10 AC 161 ms
56,072 KB
testcase_11 AC 125 ms
55,836 KB
testcase_12 AC 128 ms
55,588 KB
testcase_13 AC 127 ms
55,532 KB
testcase_14 AC 125 ms
55,844 KB
testcase_15 AC 169 ms
56,484 KB
testcase_16 AC 164 ms
55,940 KB
testcase_17 AC 169 ms
56,584 KB
testcase_18 AC 171 ms
56,432 KB
testcase_19 AC 168 ms
56,500 KB
testcase_20 AC 160 ms
56,408 KB
testcase_21 AC 166 ms
56,428 KB
testcase_22 AC 163 ms
56,404 KB
testcase_23 AC 164 ms
56,012 KB
testcase_24 AC 126 ms
55,588 KB
testcase_25 AC 164 ms
56,232 KB
testcase_26 AC 161 ms
56,208 KB
testcase_27 AC 126 ms
55,432 KB
testcase_28 AC 166 ms
56,432 KB
testcase_29 AC 165 ms
56,296 KB
testcase_30 AC 171 ms
56,084 KB
testcase_31 AC 172 ms
56,204 KB
testcase_32 AC 159 ms
56,228 KB
testcase_33 AC 124 ms
55,680 KB
testcase_34 AC 125 ms
55,668 KB
testcase_35 AC 126 ms
55,932 KB
testcase_36 AC 174 ms
56,008 KB
testcase_37 AC 124 ms
56,048 KB
testcase_38 AC 125 ms
56,284 KB
testcase_39 AC 125 ms
55,568 KB
testcase_40 AC 125 ms
55,876 KB
testcase_41 AC 126 ms
55,752 KB
testcase_42 AC 126 ms
55,888 KB
testcase_43 AC 124 ms
55,616 KB
testcase_44 AC 126 ms
55,684 KB
testcase_45 AC 126 ms
55,848 KB
testcase_46 AC 126 ms
55,772 KB
testcase_47 AC 125 ms
54,616 KB
testcase_48 AC 125 ms
55,672 KB
testcase_49 AC 125 ms
55,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		long a = sc.nextLong();
		long y = sc.nextLong();
		long b = sc.nextLong();
		sc.close();

		Map<Long, Integer> mx = bunkai(x);
		Map<Long, Integer> my = bunkai(y);
		for (long k : my.keySet()) {
			if (!mx.containsKey(k)) {
				System.out.println("No");
				return;
			}
			long vx = mx.get(k) * a;
			long vy = my.get(k) * b;
			if (vx < vy) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}

	static Map<Long, Integer> bunkai(long n) {
		Map<Long, Integer> soinsu = new HashMap<>();
		int end = (int) Math.sqrt(n);
		long d = 2;
		while (n > 1) {
			if (n % d == 0) {
				n /= d;
				soinsu.put(d, soinsu.getOrDefault(d, 0) + 1);
				end = (int) Math.sqrt(n);
			} else {
				if (d > end) {
					d = n - 1;
				}
				d++;
			}
		}
		return soinsu;
	}
}
0