結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー tentententen
提出日時 2021-11-01 15:12:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 1,883 bytes
コンパイル時間 2,218 ms
コンパイル使用メモリ 78,104 KB
実行使用メモリ 39,480 KB
最終ジャッジ日時 2024-04-18 11:30:55
合計ジャッジ時間 6,656 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
36,732 KB
testcase_01 AC 47 ms
37,200 KB
testcase_02 AC 50 ms
37,032 KB
testcase_03 AC 53 ms
37,012 KB
testcase_04 AC 73 ms
38,256 KB
testcase_05 AC 58 ms
37,440 KB
testcase_06 AC 50 ms
36,956 KB
testcase_07 AC 52 ms
36,780 KB
testcase_08 AC 66 ms
37,760 KB
testcase_09 AC 52 ms
37,048 KB
testcase_10 AC 56 ms
37,696 KB
testcase_11 AC 50 ms
37,020 KB
testcase_12 AC 52 ms
36,936 KB
testcase_13 AC 53 ms
36,944 KB
testcase_14 AC 50 ms
36,944 KB
testcase_15 AC 84 ms
39,480 KB
testcase_16 AC 67 ms
38,404 KB
testcase_17 AC 84 ms
38,332 KB
testcase_18 AC 80 ms
38,720 KB
testcase_19 AC 64 ms
37,820 KB
testcase_20 AC 52 ms
37,136 KB
testcase_21 AC 79 ms
38,236 KB
testcase_22 AC 68 ms
38,040 KB
testcase_23 AC 60 ms
37,132 KB
testcase_24 AC 53 ms
36,712 KB
testcase_25 AC 76 ms
38,512 KB
testcase_26 AC 57 ms
37,160 KB
testcase_27 AC 50 ms
37,032 KB
testcase_28 AC 84 ms
38,676 KB
testcase_29 AC 68 ms
37,716 KB
testcase_30 AC 69 ms
38,656 KB
testcase_31 AC 77 ms
38,792 KB
testcase_32 AC 54 ms
37,028 KB
testcase_33 AC 51 ms
36,856 KB
testcase_34 AC 52 ms
37,140 KB
testcase_35 AC 49 ms
37,192 KB
testcase_36 AC 91 ms
38,564 KB
testcase_37 AC 51 ms
37,100 KB
testcase_38 AC 51 ms
37,176 KB
testcase_39 AC 49 ms
36,736 KB
testcase_40 AC 52 ms
36,936 KB
testcase_41 AC 50 ms
37,308 KB
testcase_42 AC 49 ms
36,924 KB
testcase_43 AC 48 ms
36,628 KB
testcase_44 AC 50 ms
37,140 KB
testcase_45 AC 50 ms
37,200 KB
testcase_46 AC 52 ms
37,040 KB
testcase_47 AC 50 ms
37,296 KB
testcase_48 AC 52 ms
37,028 KB
testcase_49 AC 53 ms
36,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        long x = sc.nextLong();
        long a = sc.nextLong();
        HashMap<Long, Integer> xMap = new HashMap<>();
        for (long i = 2; i <= Math.sqrt(x); i++) {
            while (x % i == 0) {
                xMap.put(i, xMap.getOrDefault(i, 0) + 1);
                x /= i;
            }
        }
        if (x > 1) {
            xMap.put(x, xMap.getOrDefault(x, 0) + 1);
        }
        long y = sc.nextLong();
        long b = sc.nextLong();
        for (long i = 2; i <= Math.sqrt(y); i++) {
            int count = 0;
            while (y % i == 0) {
                count++;
                y /= i;
            }
            if (count == 0) {
                continue;
            }
            if (xMap.getOrDefault(i, 0) * a < count * b) {
                System.out.println("No");
                return;
            }
        }
        if (y > 1) {
            if (xMap.getOrDefault(y, 0) * a < b) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public String nextLine() throws Exception {
        return br.readLine();
    }
    
    public String next() throws Exception {
        if (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
0