結果
問題 |
No.588 空白と回文
|
ユーザー |
![]() |
提出日時 | 2018-05-25 23:56:25 |
言語 | Perl (5.40.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 681 bytes |
コンパイル時間 | 108 ms |
コンパイル使用メモリ | 5,632 KB |
実行使用メモリ | 5,760 KB |
最終ジャッジ日時 | 2024-06-28 18:06:58 |
合計ジャッジ時間 | 2,352 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 WA * 20 |
コンパイルメッセージ
Main.pl syntax OK
ソースコード
use strict; use warnings; my $line = <>; chomp $line; unless (length $line) { print 0; exit; } my @arr = split //,$line; my $max = 0; for (my $cent = 0; $cent < scalar @arr; $cent++) { my $count = 1; for (my $i = 1; ; $i++) { my $left = $cent - $i; my $right = $cent + $i; last if $left < 0; last if $right >= scalar @arr; $count++ if $arr[$left] eq $arr[$right]; } $max = $count if $max < $count; $count = 0; for (my $i = 1; ; $i++) { my $left = $cent; my $right = $cent + $i; last if $left < 0; last if $right >= scalar @arr; $count++ if $arr[$left] eq $arr[$right]; } $max = $count if $max < $count; } print $max;