結果

問題 No.564 背の順
ユーザー motimoti
提出日時 2018-05-17 22:00:13
言語 Perl
(5.38.2)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 368 bytes
コンパイル時間 45 ms
コンパイル使用メモリ 5,212 KB
実行使用メモリ 5,076 KB
最終ジャッジ日時 2023-09-10 22:40:43
合計ジャッジ時間 837 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#!/usr/bin/env perl

use strict;
use utf8;
use warnings;

my ($h, $_) = split(/ /, <>);
chomp $h;
my $count = 1;
while (defined(my $hi = <>)) {
  chomp $hi;
  $count += ($h < $hi) ? 1 : 0;
}
if ($count =~ /1$/) { print $count . "st\n" }
elsif ($count =~ /2$/) { print $count . "nd\n" }
elsif ($count =~ /3$/) { printf $count . "rd\n" }
else { printf $count . "th\n" }
0