結果

問題 No.1723 [Cherry 3rd Tune *] Dead on
ユーザー neko_the_shadowneko_the_shadow
提出日時 2021-11-16 22:55:11
言語 Perl
(5.38.2)
結果
AC  
実行時間 258 ms / 2,000 ms
コード長 508 bytes
コンパイル時間 65 ms
コンパイル使用メモリ 5,296 KB
実行使用メモリ 5,152 KB
最終ジャッジ日時 2023-08-23 04:39:32
合計ジャッジ時間 4,080 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
5,008 KB
testcase_01 AC 5 ms
5,112 KB
testcase_02 AC 4 ms
4,916 KB
testcase_03 AC 10 ms
5,068 KB
testcase_04 AC 115 ms
5,096 KB
testcase_05 AC 35 ms
4,956 KB
testcase_06 AC 12 ms
4,972 KB
testcase_07 AC 5 ms
5,108 KB
testcase_08 AC 32 ms
5,124 KB
testcase_09 AC 7 ms
4,916 KB
testcase_10 AC 40 ms
5,132 KB
testcase_11 AC 7 ms
4,848 KB
testcase_12 AC 12 ms
4,844 KB
testcase_13 AC 6 ms
4,920 KB
testcase_14 AC 7 ms
4,972 KB
testcase_15 AC 168 ms
5,104 KB
testcase_16 AC 45 ms
5,096 KB
testcase_17 AC 182 ms
5,076 KB
testcase_18 AC 85 ms
5,096 KB
testcase_19 AC 54 ms
5,120 KB
testcase_20 AC 26 ms
4,956 KB
testcase_21 AC 92 ms
4,972 KB
testcase_22 AC 32 ms
4,856 KB
testcase_23 AC 45 ms
4,832 KB
testcase_24 AC 7 ms
5,064 KB
testcase_25 AC 94 ms
4,960 KB
testcase_26 AC 25 ms
4,972 KB
testcase_27 AC 6 ms
5,096 KB
testcase_28 AC 108 ms
4,848 KB
testcase_29 AC 80 ms
4,848 KB
testcase_30 AC 162 ms
5,112 KB
testcase_31 AC 77 ms
4,848 KB
testcase_32 AC 23 ms
4,952 KB
testcase_33 AC 5 ms
5,004 KB
testcase_34 AC 5 ms
5,096 KB
testcase_35 AC 5 ms
4,972 KB
testcase_36 AC 258 ms
5,012 KB
testcase_37 AC 5 ms
4,964 KB
testcase_38 AC 5 ms
5,152 KB
testcase_39 AC 5 ms
4,972 KB
testcase_40 AC 5 ms
4,832 KB
testcase_41 AC 5 ms
4,964 KB
testcase_42 AC 5 ms
4,972 KB
testcase_43 AC 5 ms
4,852 KB
testcase_44 AC 5 ms
4,848 KB
testcase_45 AC 4 ms
4,960 KB
testcase_46 AC 5 ms
5,136 KB
testcase_47 AC 5 ms
5,068 KB
testcase_48 AC 5 ms
4,968 KB
testcase_49 AC 5 ms
5,116 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

use strict;
use warnings;

sub factor {
    my $n = shift;
    my %h;
    for (my $m = 2; $m*$m <= $n; $m++) {
        while ($n % $m == 0) {
            $h{$m}++;
            $n /= $m;
        }
    }

    $h{$n}++ if ($n > 1);
    return \%h;
}

sub main {
    my ($x, $a, $y, $b) = split / /, <>;
    my %h1 = %{factor($x)};
    my %h2 = %{factor($y)};

    foreach my $k (keys %h2) {
        return "No" unless (exists $h1{$k} and $h1{$k}*$a >= $h2{$k}*$b);
    }
    return "Yes";
}

print main, "\n";

0