結果

問題 No.588 空白と回文
ユーザー RisenRisen
提出日時 2017-11-03 22:40:33
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 649 bytes
コンパイル時間 2,130 ms
コンパイル使用メモリ 101,352 KB
実行使用メモリ 24,628 KB
最終ジャッジ日時 2023-08-14 17:04:04
合計ジャッジ時間 3,592 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
20,480 KB
testcase_01 AC 42 ms
22,584 KB
testcase_02 AC 40 ms
20,496 KB
testcase_03 WA -
testcase_04 AC 41 ms
18,628 KB
testcase_05 AC 42 ms
20,544 KB
testcase_06 AC 41 ms
22,620 KB
testcase_07 AC 43 ms
20,480 KB
testcase_08 AC 42 ms
18,380 KB
testcase_09 AC 40 ms
20,488 KB
testcase_10 AC 41 ms
20,652 KB
testcase_11 WA -
testcase_12 AC 42 ms
20,572 KB
testcase_13 WA -
testcase_14 AC 42 ms
20,584 KB
testcase_15 WA -
testcase_16 AC 42 ms
20,612 KB
testcase_17 AC 42 ms
20,488 KB
testcase_18 AC 41 ms
20,540 KB
testcase_19 AC 41 ms
20,472 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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);
    }
}
0