結果
問題 | No.423 ハムスター語初級(数詞) |
ユーザー |
![]() |
提出日時 | 2016-09-30 11:22:05 |
言語 | Perl (5.40.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 484 bytes |
コンパイル時間 | 34 ms |
コンパイル使用メモリ | 6,692 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-21 11:10:16 |
合計ジャッジ時間 | 612 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 7 WA * 2 |
コンパイルメッセージ
Main.pl syntax OK
ソースコード
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;