結果

問題 No.238 Mr. K's Another Gift
ユーザー tails
提出日時 2015-07-05 22:55:07
言語 Perl
(5.40.0)
結果
WA  
実行時間 -
コード長 394 bytes
コンパイル時間 138 ms
コンパイル使用メモリ 5,248 KB
実行使用メモリ 18,432 KB
最終ジャッジ日時 2024-07-07 23:34:17
合計ジャッジ時間 2,394 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 39 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

@s=<>=~/./g;
chomp;
$i=0;$j=@s-1;
while(1){
	if($i==$j){
		exit!print @s[0..$i,$j..@s-1];
	}
	if($i==$j-1){
		exit!print @s[0..$i,0,$j..@s-1];
	}
	if($s[$i]ne$s[$j]){
		$t=join'',@s[$i+1..$j];
		if( $t eq reverse $t ) {
			exit!print @s[0..$j,$i,$j+1..@s-1];
		}
		$t=join'',@s[$i..$j-1];
		if( $t eq reverse $t ) {
			exit!print @s[0..$i-1,$j,$i..@s-1];
		}
		exit!print'NA';
	}
	$i++; $j--;
}
0