結果

問題 No.588 空白と回文
ユーザー neko_the_shadowneko_the_shadow
提出日時 2018-06-22 11:53:04
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 530 ms / 2,000 ms
コード長 911 bytes
コンパイル時間 3,228 ms
コンパイル使用メモリ 103,816 KB
実行使用メモリ 23,408 KB
最終ジャッジ日時 2023-09-13 07:54:08
合計ジャッジ時間 7,750 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
23,260 KB
testcase_01 AC 52 ms
21,272 KB
testcase_02 AC 52 ms
21,304 KB
testcase_03 AC 501 ms
21,180 KB
testcase_04 AC 51 ms
21,260 KB
testcase_05 AC 53 ms
23,312 KB
testcase_06 AC 51 ms
21,312 KB
testcase_07 AC 51 ms
23,284 KB
testcase_08 AC 52 ms
21,264 KB
testcase_09 AC 51 ms
21,240 KB
testcase_10 AC 52 ms
23,304 KB
testcase_11 AC 503 ms
21,204 KB
testcase_12 AC 66 ms
21,188 KB
testcase_13 AC 51 ms
21,236 KB
testcase_14 AC 51 ms
23,296 KB
testcase_15 AC 52 ms
23,300 KB
testcase_16 AC 51 ms
19,168 KB
testcase_17 AC 402 ms
21,204 KB
testcase_18 AC 54 ms
23,408 KB
testcase_19 AC 54 ms
23,288 KB
testcase_20 AC 121 ms
21,356 KB
testcase_21 AC 530 ms
23,240 KB
testcase_22 AC 140 ms
21,180 KB
testcase_23 AC 351 ms
21,268 KB
testcase_24 AC 51 ms
21,304 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Linq;

namespace _588
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine();
            int answer = 0;
            for (int start = 0, len = str.Count(); start < len; start++)
            {
                for (int end = start; end < len; end++)
                {
                    if (str[start] != str[end])
                    {
                        continue;
                    }

                    int count = 0;
                    for (int x = start, y = end; x <= end; x++, y--)
                    {
                        if (str[x] == str[y])
                        {
                            count++;
                        }
                    }

                    answer = Math.Max(answer, count);
                }
            }

            Console.WriteLine(answer);
        }
    }
}
0