結果

問題 No.273 回文分解
ユーザー eitaho
提出日時 2015-08-28 22:23:16
言語 C#
(csc 3.5.0-beta1-19606-04)
結果
AC  
実行時間 44 ms
コード長 2,320 Byte
コンパイル時間 1,348 ms
使用メモリ 18,656 KB
最終ジャッジ日時 2020-03-31 23:49:03

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
scramble_00 AC 34 ms
16,576 KB
scramble_01 AC 36 ms
16,616 KB
scramble_02 AC 32 ms
16,580 KB
scramble_03 AC 36 ms
16,584 KB
scramble_04 AC 34 ms
16,588 KB
scramble_05 AC 38 ms
16,612 KB
scramble_06 AC 38 ms
16,616 KB
scramble_07 AC 37 ms
16,596 KB
scramble_08 AC 35 ms
16,608 KB
scramble_09 AC 33 ms
16,616 KB
scramble_10 AC 37 ms
16,576 KB
scramble_11 AC 35 ms
16,592 KB
scramble_12 AC 35 ms
14,536 KB
scramble_13 AC 36 ms
14,556 KB
scramble_14 AC 36 ms
14,576 KB
scramble_15 AC 33 ms
16,580 KB
scramble_16 AC 35 ms
14,536 KB
scramble_17 AC 34 ms
14,532 KB
scramble_18 AC 37 ms
16,576 KB
scramble_19 AC 38 ms
16,608 KB
scramble_20 AC 33 ms
14,552 KB
scramble_21 AC 35 ms
12,516 KB
scramble_22 AC 36 ms
14,564 KB
scramble_23 AC 38 ms
16,616 KB
scramble_24 AC 35 ms
14,556 KB
scramble_25 AC 38 ms
14,572 KB
scramble_26 AC 39 ms
18,656 KB
scramble_27 AC 37 ms
14,556 KB
scramble_28 AC 39 ms
16,596 KB
scramble_29 AC 44 ms
14,564 KB
scramble_30 AC 38 ms
16,604 KB
scramble_31 AC 36 ms
18,636 KB
scramble_32 AC 36 ms
18,636 KB
scramble_33 AC 35 ms
14,532 KB
scramble_34 AC 34 ms
14,532 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.5.0-beta1-19606-04 (d2bd58c6)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Diagnostics;
using System.Numerics;
using Enu = System.Linq.Enumerable;

class Program
{
    public void Solve()
    {
        var S = Reader.String();
        int ans = 0;
        for (int i = 0; i < S.Length; i++)
            for (int len = 1; len < S.Length && i + len <= S.Length; len++)
                if (S.Substring(i, len) == new string(S.Substring(i, len).Reverse().ToArray()))
                    ans = Math.Max(ans, len);
        Console.WriteLine(ans);
    }
}


class Entry { static void Main() { new Program().Solve(); } }
class Reader
{
    private static TextReader reader = Console.In;
    private static readonly char[] separator = { ' ' };
    private static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries;
    private static string[] A = new string[0];
    private static int i;
    private static void Init() { A = new string[0]; }
    public static void Set(TextReader r) { reader = r; Init(); }
    public static void Set(string file) { reader = new StreamReader(file); Init(); }
    public static bool HasNext() { return CheckNext(); }
    public static string String() { return Next(); }
    public static int Int() { return int.Parse(Next()); }
    public static long Long() { return long.Parse(Next()); }
    public static double Double() { return double.Parse(Next()); }
    public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); }
    public static int[] IntArray(int N) { return Enu.Range(0, N).Select(i => Int()).ToArray(); }
    public static int[][] IntTable(int H) { return Enu.Range(0, H).Select(i => IntLine()).ToArray(); }
    public static string[] StringArray(int N) { return Enu.Range(0, N).Select(i => Next()).ToArray(); }
    public static string Line() { return reader.ReadLine().Trim(); }
    private static string[] Split(string s) { return s.Split(separator, op); }
    private static string Next() { CheckNext(); return A[i++]; }
    private static bool CheckNext()
    {
        if (i < A.Length) return true;
        string line = reader.ReadLine();
        if (line == null) return false;
        if (line == "") return CheckNext();
        A = Split(line);
        i = 0;
        return true;
    }
}
0