結果

問題 No.1729 ~サンプルはちゃんと見て!~ 16進数と8進数(1)
ユーザー neko_the_shadowneko_the_shadow
提出日時 2021-11-17 17:10:20
言語 Perl
(5.38.2)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 395 bytes
コンパイル時間 593 ms
コンパイル使用メモリ 11,884 KB
実行使用メモリ 12,128 KB
最終ジャッジ日時 2023-08-25 11:20:07
合計ジャッジ時間 3,584 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
11,892 KB
testcase_01 AC 46 ms
12,128 KB
testcase_02 AC 46 ms
11,824 KB
testcase_03 AC 46 ms
11,872 KB
testcase_04 AC 46 ms
12,040 KB
testcase_05 AC 46 ms
11,768 KB
testcase_06 AC 46 ms
11,884 KB
testcase_07 AC 46 ms
11,828 KB
testcase_08 AC 62 ms
11,836 KB
testcase_09 AC 64 ms
11,820 KB
testcase_10 AC 63 ms
12,100 KB
testcase_11 AC 52 ms
11,828 KB
testcase_12 AC 60 ms
11,900 KB
testcase_13 AC 61 ms
11,764 KB
testcase_14 AC 47 ms
11,980 KB
testcase_15 AC 47 ms
11,776 KB
testcase_16 AC 59 ms
11,828 KB
testcase_17 AC 56 ms
11,868 KB
testcase_18 AC 55 ms
11,976 KB
testcase_19 AC 46 ms
11,772 KB
testcase_20 AC 48 ms
12,044 KB
testcase_21 AC 46 ms
11,844 KB
testcase_22 AC 47 ms
12,124 KB
testcase_23 AC 47 ms
11,992 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

use strict;
use warnings;
use bigint;
use Data::Dumper;
use List::Util qw/max/;

chomp(my $N = <>);

my $dec = 0;
my $base = 1;
foreach (reverse split //, $N) {
    $dec += $base * (ord($_) - ord('A') + 10);
    $base *= 16;
}

my %h1;
while ($dec > 0) {
    $h1{$dec%8}++;
    $dec /= 8;
}

my %h2;
push @{$h2{$h1{$_}}}, $_ foreach (keys %h1);

print join(" ", sort @{$h2{max keys %h2}}), "\n";
0