結果

問題 No.273 回文分解
ユーザー NoNo
提出日時 2015-11-04 19:00:12
言語 C#(csc)
(csc 3.9.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,162 bytes
コンパイル時間 2,177 ms
コンパイル使用メモリ 109,328 KB
実行使用メモリ 23,468 KB
最終ジャッジ日時 2023-08-25 01:26:53
合計ジャッジ時間 5,446 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
21,564 KB
testcase_01 AC 53 ms
21,348 KB
testcase_02 AC 53 ms
23,256 KB
testcase_03 AC 52 ms
19,448 KB
testcase_04 AC 53 ms
23,392 KB
testcase_05 AC 54 ms
19,208 KB
testcase_06 AC 55 ms
21,380 KB
testcase_07 AC 55 ms
19,296 KB
testcase_08 AC 53 ms
21,380 KB
testcase_09 AC 55 ms
21,456 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 52 ms
21,220 KB
testcase_15 AC 53 ms
23,432 KB
testcase_16 AC 53 ms
21,288 KB
testcase_17 AC 54 ms
23,256 KB
testcase_18 AC 53 ms
21,216 KB
testcase_19 AC 52 ms
21,264 KB
testcase_20 AC 52 ms
21,520 KB
testcase_21 AC 53 ms
21,284 KB
testcase_22 AC 53 ms
23,352 KB
testcase_23 AC 52 ms
21,344 KB
testcase_24 AC 53 ms
21,352 KB
testcase_25 AC 54 ms
23,380 KB
testcase_26 AC 53 ms
21,244 KB
testcase_27 AC 53 ms
21,268 KB
testcase_28 AC 53 ms
21,288 KB
testcase_29 AC 56 ms
21,368 KB
testcase_30 AC 54 ms
23,308 KB
testcase_31 AC 53 ms
21,268 KB
testcase_32 AC 53 ms
23,256 KB
testcase_33 AC 53 ms
21,252 KB
testcase_34 AC 54 ms
23,468 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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

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)) && a.Length > max) max = a.Length;
                }
            }

            if (max == 0)
            {
                for (int i = 0; i < s.Length; i++)
                {
                    if (s.Where(x => x == s[i]).Count() >= 2)
                    {
                        max = 1;
                        break;
                    }
                }
            }

            Console.WriteLine(max);
        }
    }
}
0