結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー tentententen
提出日時 2022-08-09 08:21:32
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,759 bytes
コンパイル時間 3,949 ms
コンパイル使用メモリ 79,304 KB
実行使用メモリ 55,904 KB
最終ジャッジ日時 2023-10-19 19:30:02
合計ジャッジ時間 9,529 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
53,348 KB
testcase_01 AC 55 ms
53,292 KB
testcase_02 AC 57 ms
53,348 KB
testcase_03 AC 57 ms
53,364 KB
testcase_04 AC 78 ms
53,924 KB
testcase_05 AC 67 ms
53,988 KB
testcase_06 AC 58 ms
53,356 KB
testcase_07 AC 56 ms
53,344 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 68 ms
53,980 KB
testcase_11 WA -
testcase_12 AC 58 ms
53,352 KB
testcase_13 WA -
testcase_14 AC 56 ms
51,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 96 ms
55,040 KB
testcase_18 WA -
testcase_19 AC 86 ms
54,672 KB
testcase_20 AC 65 ms
53,904 KB
testcase_21 WA -
testcase_22 AC 68 ms
52,652 KB
testcase_23 AC 86 ms
54,808 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 65 ms
53,904 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 96 ms
55,120 KB
testcase_30 AC 105 ms
55,904 KB
testcase_31 WA -
testcase_32 AC 65 ms
53,988 KB
testcase_33 AC 57 ms
53,364 KB
testcase_34 WA -
testcase_35 AC 56 ms
53,352 KB
testcase_36 AC 101 ms
55,108 KB
testcase_37 AC 55 ms
52,268 KB
testcase_38 AC 56 ms
53,352 KB
testcase_39 AC 55 ms
53,352 KB
testcase_40 AC 56 ms
53,340 KB
testcase_41 AC 55 ms
53,348 KB
testcase_42 WA -
testcase_43 AC 55 ms
53,348 KB
testcase_44 AC 55 ms
53,344 KB
testcase_45 AC 55 ms
53,352 KB
testcase_46 WA -
testcase_47 AC 57 ms
53,340 KB
testcase_48 AC 55 ms
53,352 KB
testcase_49 AC 57 ms
53,348 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();
        long y = sc.nextLong();
        long b = sc.nextLong();
        HashMap<Long, Integer> countsX = getCount(x);
        HashMap<Long, Integer> countsY = getCount(y);
        for (long z : countsY.keySet()) {
            if (!countsX.containsKey(z) || countsX.get(z) * a % (countsY.get(z) * b) != 0) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
    
    static HashMap<Long, Integer> getCount(long x) {
        HashMap<Long, Integer> ans = new HashMap<>();
        for (long i = 2; i <= Math.sqrt(x); i++) {
            while (x % i == 0) {
                ans.put(i, ans.getOrDefault(i, 0) + 1);
                x /= i;
            }
        }
        if (x > 1) {
            ans.put(x, ans.getOrDefault(x, 0) + 1);
        }
        return ans;
    }
}

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 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