結果

問題 No.588 空白と回文
ユーザー Charlotte8687Charlotte8687
提出日時 2017-11-14 13:01:59
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 978 bytes
コンパイル時間 1,949 ms
コンパイル使用メモリ 102,392 KB
実行使用メモリ 22,752 KB
最終ジャッジ日時 2023-08-16 13:03:43
合計ジャッジ時間 4,499 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
20,500 KB
testcase_01 AC 50 ms
22,536 KB
testcase_02 AC 50 ms
20,412 KB
testcase_03 WA -
testcase_04 AC 50 ms
20,588 KB
testcase_05 AC 50 ms
20,600 KB
testcase_06 AC 50 ms
20,444 KB
testcase_07 AC 50 ms
22,636 KB
testcase_08 AC 50 ms
20,508 KB
testcase_09 AC 50 ms
20,588 KB
testcase_10 AC 51 ms
22,540 KB
testcase_11 WA -
testcase_12 AC 52 ms
22,528 KB
testcase_13 WA -
testcase_14 AC 51 ms
20,556 KB
testcase_15 WA -
testcase_16 AC 51 ms
22,624 KB
testcase_17 AC 51 ms
20,620 KB
testcase_18 AC 50 ms
20,596 KB
testcase_19 AC 50 ms
20,576 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;
using System.Text;
using System.Threading.Tasks;

namespace SpaceEscape
{
    class Program
    {
        static void Main(string[] args)
        {
            string target = Console.ReadLine();
            Console.WriteLine(checkAnagram(target));
        }

        static int checkAnagram(string str)
        {
            int max_count = 0; // max count for anagram word
            for (int i = 0; i < str.Length; i++)
            {
                int count = 0; // count for anagram word
                for (int j = 1; j < str.Length; j++)
                {
                    if (i + j >= str.Length || i - j < 0)
                        break;

                    if (str[i + j] == str[i - j])
                        count++;
                }

                if (max_count < count)
                    max_count = count;


            }

            return max_count * 2 + 1;

        }
    }
}

0