結果
問題 | No.486 3 Straight Win(3連勝) |
ユーザー |
![]() |
提出日時 | 2017-03-21 19:57:59 |
言語 | Perl (5.40.0) |
結果 |
AC
|
実行時間 | 8 ms / 2,000 ms |
コード長 | 596 bytes |
コンパイル時間 | 253 ms |
コンパイル使用メモリ | 6,816 KB |
実行使用メモリ | 5,760 KB |
最終ジャッジ日時 | 2024-06-26 04:22:39 |
合計ジャッジ時間 | 1,417 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
コンパイルメッセージ
Main.pl syntax OK
ソースコード
use strict;use warnings;use utf8;sub check {my $list = shift;my $index = shift;for my $n (1..2){if($list->[$index] ne $list->[$index + $n]){return undef;}}return 1;}sub solver {my $list = shift;return 'NA' if (scalar @$list) <= 1;my $max = (scalar @$list) - 2;for my $c (0..$max){my $ans = ($list->[$c] eq 'O') ? 'East' : 'West';if(check($list,$c)){return $ans;}}return 'NA';}chomp(my $input = <STDIN>);my @data = split //, $input;print solver(\@data),"\n";