結果
問題 | No.423 ハムスター語初級(数詞) |
ユーザー |
![]() |
提出日時 | 2016-09-30 11:39:02 |
言語 | Perl (5.40.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 499 bytes |
コンパイル時間 | 36 ms |
コンパイル使用メモリ | 6,688 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-21 11:10:31 |
合計ジャッジ時間 | 588 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
コンパイルメッセージ
Main.pl syntax OK
ソースコード
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) {push(@ans, 0);} elsif($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;