結果

問題 No.273 回文分解
ユーザー eitaho
提出日時 2015-08-28 22:23:16
言語 C#
(csc 3.100.19.26603)
結果
AC  
実行時間 36 ms
コード長 2,320 Byte
コンパイル時間 1,161 ms
使用メモリ 18,604 KB
最終ジャッジ日時 2019-10-18 01:39:24

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
99_system_test1.txt AC 32 ms
16,508 KB
99_system_test2.txt AC 33 ms
16,560 KB
99_system_test3.txt AC 34 ms
18,564 KB
sample1.txt AC 31 ms
14,488 KB
sample2.txt AC 33 ms
18,564 KB
sample3.txt AC 34 ms
18,604 KB
system_test1.txt AC 34 ms
18,604 KB
system_test2.txt AC 33 ms
18,568 KB
system_test3.txt AC 33 ms
14,512 KB
system_test4.txt AC 34 ms
16,564 KB
system_test5.txt AC 32 ms
16,512 KB
system_test6.txt AC 34 ms
16,528 KB
system_test7.txt AC 32 ms
14,480 KB
system_test8.txt AC 34 ms
16,520 KB
system_test9.txt AC 35 ms
16,540 KB
test1.txt AC 33 ms
16,524 KB
test2.txt AC 32 ms
16,516 KB
test3.txt AC 34 ms
16,528 KB
test4.txt AC 32 ms
14,480 KB
test5.txt AC 33 ms
14,516 KB
test6.txt AC 32 ms
14,476 KB
test7.txt AC 33 ms
16,520 KB
test8.txt AC 35 ms
14,500 KB
test9.txt AC 35 ms
14,504 KB
test10.txt AC 36 ms
16,540 KB
test11.txt AC 35 ms
18,592 KB
test12.txt AC 36 ms
16,540 KB
test13.txt AC 35 ms
16,552 KB
test14.txt AC 36 ms
16,544 KB
test15.txt AC 35 ms
16,544 KB
test16.txt AC 35 ms
14,496 KB
test17.txt AC 33 ms
16,512 KB
test18.txt AC 32 ms
16,524 KB
test19.txt AC 34 ms
18,560 KB
test20.txt AC 32 ms
16,512 KB
テストケース一括ダウンロード
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.100.19.26603 (9d80dea7)
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