結果

問題 No.273 回文分解
ユーザー nanophoto12nanophoto12
提出日時 2015-12-07 23:00:09
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 782 bytes
コンパイル時間 2,128 ms
コンパイル使用メモリ 105,344 KB
実行使用メモリ 25,568 KB
最終ジャッジ日時 2023-08-25 01:28:15
合計ジャッジ時間 5,216 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 51 ms
21,536 KB
testcase_04 AC 50 ms
21,676 KB
testcase_05 AC 52 ms
21,684 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 50 ms
19,452 KB
testcase_09 WA -
testcase_10 AC 50 ms
21,432 KB
testcase_11 AC 52 ms
25,504 KB
testcase_12 AC 53 ms
23,480 KB
testcase_13 AC 51 ms
21,488 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 51 ms
21,492 KB
testcase_18 WA -
testcase_19 AC 51 ms
23,584 KB
testcase_20 AC 52 ms
23,544 KB
testcase_21 AC 52 ms
23,512 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 51 ms
19,628 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 53 ms
21,632 KB
testcase_28 AC 52 ms
23,484 KB
testcase_29 AC 53 ms
21,540 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 50 ms
19,496 KB
testcase_33 AC 51 ms
23,668 KB
testcase_34 AC 53 ms
23,512 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;

namespace No273
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			var s = Console.ReadLine ();
			var r = new string(s.Reverse ().ToArray());

			int maxMatch = 0;
			for (int i = 1; i < s.Length; i++) {
				int a = 0;
				for (int k = 0; k + i< s.Length; k++) {
					if (s [i + k] == r [k]) {
						a++;
						maxMatch = Math.Max (maxMatch, a);
					} else {
						a = 0;
					}
				}
			}
			for (int i = 0; i < s.Length-1; i++) {
				int a = 0;
				for (int k = 1; k + i< s.Length; k++) {
					if (s [i + k] == r [k]) {
						a++;
						maxMatch = Math.Max (maxMatch, a);
					} else {
						a = 0;
					}
				}
			}
			Console.WriteLine (maxMatch.ToString ());
		}
	}
}
0