結果

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

テストケース

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

ソースコード

diff #

use strict;
use warnings;
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;
my $flag = 0;
for(my $i = 0; $i <= $#ans; $i++) {
	if(($ans[$i] == 0)&&($flag == 1)) {
		print "ham";
	} else {
		print "hamu";
		$flag = 1;
	}
}
print $/;
exit;
0