結果

問題 No.542 1円玉と5円玉
ユーザー motimoti
提出日時 2018-05-20 09:00:02
言語 Perl
(5.38.2)
結果
TLE  
実行時間 -
コード長 437 bytes
コンパイル時間 62 ms
コンパイル使用メモリ 5,324 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-09-10 23:54:16
合計ジャッジ時間 5,112 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
5,076 KB
testcase_01 AC 5 ms
5,020 KB
testcase_02 AC 5 ms
4,956 KB
testcase_03 AC 5 ms
5,012 KB
testcase_04 AC 5 ms
5,036 KB
testcase_05 AC 839 ms
4,940 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

#!/usr/bin/env perl

use strict;
use warnings;

my %h;
sub dfs {
  my ($one, $five, $count) = @_;
  if ($one > 0) {
    $h{$count + 1} = 1;
    dfs($one - 1, $five, $count + 1);
  }
  if ($five > 0) {
    $h{$count + 5} = 1;
    dfs($one, $five - 1, $count + 5);
  }
}

my ($x, $y) = split / /,<>; chomp$y;
dfs $x, $y, 0;
my @vs;
while (my ($k, $v) = each(%h)) {
  push @vs, $k;
}
for my $x (sort {$a <=> $b} @vs) {
  print $x . "\n";
}
0