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