結果

問題 No.273 回文分解
ユーザー NoNo
提出日時 2017-05-19 02:10:44
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 856 bytes
コンパイル時間 3,282 ms
コンパイル使用メモリ 108,304 KB
実行使用メモリ 22,576 KB
最終ジャッジ日時 2023-09-07 20:04:46
合計ジャッジ時間 6,376 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
22,576 KB
testcase_01 AC 53 ms
22,572 KB
testcase_02 AC 53 ms
20,404 KB
testcase_03 AC 52 ms
20,412 KB
testcase_04 AC 51 ms
20,432 KB
testcase_05 AC 52 ms
22,524 KB
testcase_06 AC 52 ms
22,460 KB
testcase_07 AC 52 ms
22,472 KB
testcase_08 AC 52 ms
22,364 KB
testcase_09 AC 52 ms
22,460 KB
testcase_10 AC 52 ms
22,564 KB
testcase_11 AC 52 ms
20,596 KB
testcase_12 AC 53 ms
22,536 KB
testcase_13 AC 52 ms
20,420 KB
testcase_14 AC 52 ms
20,480 KB
testcase_15 AC 52 ms
22,524 KB
testcase_16 AC 52 ms
20,416 KB
testcase_17 AC 52 ms
20,456 KB
testcase_18 AC 51 ms
20,480 KB
testcase_19 AC 52 ms
20,436 KB
testcase_20 AC 53 ms
20,420 KB
testcase_21 AC 52 ms
20,528 KB
testcase_22 AC 53 ms
22,524 KB
testcase_23 AC 54 ms
22,456 KB
testcase_24 AC 53 ms
20,432 KB
testcase_25 AC 51 ms
18,484 KB
testcase_26 AC 53 ms
22,380 KB
testcase_27 AC 53 ms
22,484 KB
testcase_28 AC 53 ms
20,396 KB
testcase_29 AC 53 ms
20,508 KB
testcase_30 AC 53 ms
20,540 KB
testcase_31 AC 52 ms
20,400 KB
testcase_32 AC 52 ms
20,408 KB
testcase_33 AC 53 ms
22,468 KB
testcase_34 AC 53 ms
22,472 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace Yuki
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string a;
            int max = s.Length == 2 && s[0].Equals(s[1]) ? 1 : 0;

            for (int i = 0; i < s.Length; i++)
            {
                a = s[i].ToString();
                for (int j = i + 1; j < s.Length; j++)
                {
                    a += s[j];
                    if (a.Length == s.Length) break;
                    char[] b = a.ToCharArray();
                    Array.Reverse(b);
                    if (a.Equals(new string(b))) max = Math.Max(max, a.Length);
                }
            }

            if (max == 0)
            {
                max = 1;
            }
            Console.WriteLine(max);
            Console.ReadLine();
        }
    }
}
0