結果
問題 |
No.588 空白と回文
|
ユーザー |
![]() |
提出日時 | 2017-11-03 22:40:33 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 649 bytes |
コンパイル時間 | 1,065 ms |
コンパイル使用メモリ | 103,040 KB |
実行使用メモリ | 17,792 KB |
最終ジャッジ日時 | 2024-11-22 16:05:57 |
合計ジャッジ時間 | 2,458 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 WA * 9 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Linq; class Solution { static void Main() { var s = Console.ReadLine(); var bestLen = 0; for (int i = 0; i < s.Length; i++) { int len = 1; int left = i - 1; int right = i + 1; while (left >= 0 && right < s.Length) { if (s[left] == s[right]) { len += 2; } left--; right++; } bestLen = Math.Max(len, bestLen); } Console.WriteLine(bestLen); } }