結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー tentententen
提出日時 2022-09-28 15:21:28
言語 Java21
(openjdk 21)
結果
AC  
実行時間 92 ms / 2,000 ms
コード長 1,729 bytes
コンパイル時間 3,727 ms
コンパイル使用メモリ 75,804 KB
実行使用メモリ 52,676 KB
最終ジャッジ日時 2023-08-24 04:26:02
合計ジャッジ時間 7,764 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,184 KB
testcase_01 AC 43 ms
49,100 KB
testcase_02 AC 42 ms
48,940 KB
testcase_03 AC 43 ms
49,296 KB
testcase_04 AC 63 ms
49,968 KB
testcase_05 AC 57 ms
49,984 KB
testcase_06 AC 44 ms
49,336 KB
testcase_07 AC 43 ms
49,148 KB
testcase_08 AC 53 ms
50,056 KB
testcase_09 AC 44 ms
49,356 KB
testcase_10 AC 54 ms
50,648 KB
testcase_11 AC 43 ms
49,464 KB
testcase_12 AC 46 ms
49,104 KB
testcase_13 AC 42 ms
47,228 KB
testcase_14 AC 45 ms
49,472 KB
testcase_15 AC 81 ms
52,172 KB
testcase_16 AC 72 ms
51,496 KB
testcase_17 AC 81 ms
51,952 KB
testcase_18 AC 86 ms
52,400 KB
testcase_19 AC 72 ms
52,016 KB
testcase_20 AC 52 ms
49,776 KB
testcase_21 AC 87 ms
52,416 KB
testcase_22 AC 55 ms
50,004 KB
testcase_23 AC 57 ms
49,816 KB
testcase_24 AC 42 ms
49,404 KB
testcase_25 AC 83 ms
52,384 KB
testcase_26 AC 53 ms
49,844 KB
testcase_27 AC 44 ms
48,988 KB
testcase_28 AC 89 ms
52,380 KB
testcase_29 AC 85 ms
52,144 KB
testcase_30 AC 92 ms
52,676 KB
testcase_31 AC 80 ms
52,056 KB
testcase_32 AC 53 ms
49,664 KB
testcase_33 AC 44 ms
49,236 KB
testcase_34 AC 44 ms
49,072 KB
testcase_35 AC 44 ms
47,024 KB
testcase_36 AC 87 ms
52,240 KB
testcase_37 AC 42 ms
49,028 KB
testcase_38 AC 43 ms
49,104 KB
testcase_39 AC 42 ms
49,108 KB
testcase_40 AC 43 ms
49,372 KB
testcase_41 AC 43 ms
49,216 KB
testcase_42 AC 43 ms
49,128 KB
testcase_43 AC 43 ms
49,112 KB
testcase_44 AC 43 ms
47,904 KB
testcase_45 AC 42 ms
49,264 KB
testcase_46 AC 43 ms
49,348 KB
testcase_47 AC 43 ms
49,428 KB
testcase_48 AC 41 ms
47,096 KB
testcase_49 AC 42 ms
49,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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