結果

問題 No.423 ハムスター語初級(数詞)
ユーザー togaerrortogaerror
提出日時 2016-09-30 11:22:05
言語 Perl
(5.38.2)
結果
WA  
実行時間 -
コード長 484 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 7,072 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-01 08:12:05
合計ジャッジ時間 720 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
6,812 KB
testcase_01 AC 7 ms
6,944 KB
testcase_02 AC 6 ms
6,940 KB
testcase_03 WA -
testcase_04 AC 6 ms
6,940 KB
testcase_05 AC 6 ms
6,940 KB
testcase_06 AC 6 ms
6,940 KB
testcase_07 WA -
testcase_08 AC 6 ms
6,940 KB
testcase_09 AC 6 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

use strict;
use warnings;
use 5.010;

my $s = <>;
chomp $s;
my @str = split //, $s;
my @ans;
for(my $i = 0; $i < $#str; $i++) {
	if($str[$i] eq 'm') {
		if(($i != $#str)and($str[$i + 1] eq 'u')) {
			push(@ans, 1);
		} else {
			push(@ans, 0);
		}
	}
}

my $num = join '', @ans;
$num = oct "0b" . $num;
$num *= 2;
$num = sprintf "%b", $num;
@ans = split //, $num;

for(my $i = 0; $i <= $#ans; $i++) {
	if($ans[$i] == 0) {
		print "ham";
	} else {
		print "hamu";
	}
}
print $/;

exit;
0