結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー tentententen
提出日時 2024-04-24 17:17:11
言語 Java21
(openjdk 21)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 1,882 bytes
コンパイル時間 2,561 ms
コンパイル使用メモリ 79,488 KB
実行使用メモリ 38,200 KB
最終ジャッジ日時 2024-04-24 17:17:18
合計ジャッジ時間 7,124 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
36,964 KB
testcase_01 AC 50 ms
36,620 KB
testcase_02 AC 51 ms
36,792 KB
testcase_03 AC 52 ms
36,792 KB
testcase_04 AC 54 ms
37,048 KB
testcase_05 AC 53 ms
37,172 KB
testcase_06 AC 53 ms
36,816 KB
testcase_07 AC 52 ms
37,204 KB
testcase_08 AC 57 ms
36,616 KB
testcase_09 AC 53 ms
36,972 KB
testcase_10 AC 57 ms
36,884 KB
testcase_11 AC 52 ms
37,040 KB
testcase_12 AC 52 ms
37,048 KB
testcase_13 AC 52 ms
36,988 KB
testcase_14 AC 51 ms
36,676 KB
testcase_15 AC 73 ms
37,992 KB
testcase_16 AC 58 ms
37,052 KB
testcase_17 AC 75 ms
37,992 KB
testcase_18 AC 70 ms
38,068 KB
testcase_19 AC 64 ms
37,300 KB
testcase_20 AC 56 ms
36,924 KB
testcase_21 AC 69 ms
37,940 KB
testcase_22 AC 58 ms
37,164 KB
testcase_23 AC 59 ms
36,664 KB
testcase_24 AC 52 ms
36,888 KB
testcase_25 AC 73 ms
37,980 KB
testcase_26 AC 54 ms
36,964 KB
testcase_27 AC 51 ms
36,628 KB
testcase_28 AC 70 ms
37,892 KB
testcase_29 AC 77 ms
37,756 KB
testcase_30 AC 75 ms
38,200 KB
testcase_31 AC 66 ms
37,636 KB
testcase_32 AC 54 ms
36,840 KB
testcase_33 AC 53 ms
37,168 KB
testcase_34 AC 51 ms
37,104 KB
testcase_35 AC 50 ms
36,884 KB
testcase_36 AC 79 ms
38,088 KB
testcase_37 AC 52 ms
37,036 KB
testcase_38 AC 51 ms
36,520 KB
testcase_39 AC 50 ms
37,108 KB
testcase_40 AC 54 ms
36,828 KB
testcase_41 AC 53 ms
36,824 KB
testcase_42 AC 51 ms
37,028 KB
testcase_43 AC 52 ms
36,880 KB
testcase_44 AC 52 ms
37,040 KB
testcase_45 AC 52 ms
37,156 KB
testcase_46 AC 52 ms
37,036 KB
testcase_47 AC 53 ms
37,108 KB
testcase_48 AC 52 ms
37,116 KB
testcase_49 AC 52 ms
36,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        long x = sc.nextLong();
        long a = sc.nextLong();
        long y = sc.nextLong();
        long b = sc.nextLong();
        Map<Long, Integer> counts = new HashMap<>();
        for (long i = 2; i <= Math.sqrt(y); i++) {
            while (y % i == 0) {
                counts.put(i, counts.getOrDefault(i, 0) + 1);
                y /= i;
            }
        }
        if (y > 1) {
            counts.put(y, counts.getOrDefault(y, 0) + 1);
        }
        for (long d : counts.keySet()) {
            int current = 0;
            while (x % d == 0) {
                current++;
                x /= d;
            }
            if (counts.get(d) * b > current * a) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}
class Scanner {
    BufferedReader br;
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
        } catch (Exception e) {
            
        }
    }
    
    public int nextInt() {
        return Integer.parseInt(next());
    }
    
    public long nextLong() {
        return Long.parseLong(next());
    }
    
    public double nextDouble() {
        return Double.parseDouble(next());
    }
    
    public String next() {
        try {
            while (!st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            return st.nextToken();
        }
    }
    
}
0