結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー merlinmerlin
提出日時 2021-10-29 21:36:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 1,106 bytes
コンパイル時間 2,455 ms
コンパイル使用メモリ 85,040 KB
実行使用メモリ 38,648 KB
最終ジャッジ日時 2024-04-16 14:18:34
合計ジャッジ時間 6,992 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
36,988 KB
testcase_01 AC 53 ms
36,884 KB
testcase_02 AC 53 ms
37,032 KB
testcase_03 AC 53 ms
36,984 KB
testcase_04 AC 76 ms
37,672 KB
testcase_05 AC 65 ms
36,984 KB
testcase_06 AC 55 ms
36,888 KB
testcase_07 AC 55 ms
36,876 KB
testcase_08 AC 64 ms
37,180 KB
testcase_09 AC 54 ms
36,656 KB
testcase_10 AC 67 ms
36,912 KB
testcase_11 AC 54 ms
37,060 KB
testcase_12 AC 56 ms
36,828 KB
testcase_13 AC 52 ms
36,852 KB
testcase_14 AC 53 ms
37,036 KB
testcase_15 AC 87 ms
37,932 KB
testcase_16 AC 80 ms
37,792 KB
testcase_17 AC 89 ms
38,056 KB
testcase_18 AC 80 ms
38,440 KB
testcase_19 AC 80 ms
37,620 KB
testcase_20 AC 62 ms
37,096 KB
testcase_21 AC 92 ms
38,488 KB
testcase_22 AC 62 ms
37,064 KB
testcase_23 AC 80 ms
38,004 KB
testcase_24 AC 54 ms
36,776 KB
testcase_25 AC 91 ms
38,352 KB
testcase_26 AC 61 ms
36,944 KB
testcase_27 AC 53 ms
36,856 KB
testcase_28 AC 82 ms
38,348 KB
testcase_29 AC 82 ms
38,468 KB
testcase_30 AC 96 ms
38,648 KB
testcase_31 AC 91 ms
38,456 KB
testcase_32 AC 61 ms
36,932 KB
testcase_33 AC 53 ms
36,708 KB
testcase_34 AC 53 ms
36,980 KB
testcase_35 AC 55 ms
36,924 KB
testcase_36 AC 99 ms
38,052 KB
testcase_37 AC 52 ms
36,660 KB
testcase_38 AC 54 ms
36,932 KB
testcase_39 AC 55 ms
36,944 KB
testcase_40 AC 55 ms
37,020 KB
testcase_41 AC 54 ms
36,928 KB
testcase_42 AC 52 ms
36,560 KB
testcase_43 AC 54 ms
37,024 KB
testcase_44 AC 54 ms
36,872 KB
testcase_45 AC 55 ms
36,680 KB
testcase_46 AC 57 ms
37,096 KB
testcase_47 AC 55 ms
36,940 KB
testcase_48 AC 54 ms
36,972 KB
testcase_49 AC 53 ms
36,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder();
        String s[]=bu.readLine().split(" ");
        long x=Long.parseLong(s[0]),a=Long.parseLong(s[1]),y=Long.parseLong(s[2]),b=Long.parseLong(s[3]);
        HashMap<Long,Long> fa=factors(x,a),fb=factors(y,b);

        boolean ans=true;
        for(long f:fb.keySet())
        {
            long u=fb.get(f),v=fa.getOrDefault(f,0l);
            if(v<u) {ans=false; break;}
        }
        if(ans) sb.append("Yes\n");
        else sb.append("No\n");
        System.out.print(sb);
    }

    static HashMap<Long,Long> factors(long a,long b)
    {
        long i;
        HashMap<Long,Long> hm=new HashMap<>();
        for(i=2;i*i<=a;i++)
        if(a%i==0)
        {
            long c=0;
            while(a%i==0)
            {
                a/=i; c++;
            }
            hm.put(i,c*b);
        }
        if(a>1) hm.put(a,b);
        return hm;
    }
}
0