結果
問題 | No.273 回文分解 |
ユーザー | Himatsubushin |
提出日時 | 2015-12-26 16:49:21 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 54 ms / 2,000 ms |
コード長 | 883 bytes |
コンパイル時間 | 2,008 ms |
コンパイル使用メモリ | 102,840 KB |
実行使用メモリ | 22,656 KB |
最終ジャッジ日時 | 2023-09-07 19:47:45 |
合計ジャッジ時間 | 5,262 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 51 ms
20,496 KB |
testcase_01 | AC | 52 ms
20,456 KB |
testcase_02 | AC | 52 ms
20,428 KB |
testcase_03 | AC | 53 ms
22,600 KB |
testcase_04 | AC | 54 ms
22,520 KB |
testcase_05 | AC | 52 ms
22,484 KB |
testcase_06 | AC | 52 ms
20,608 KB |
testcase_07 | AC | 52 ms
20,528 KB |
testcase_08 | AC | 53 ms
22,636 KB |
testcase_09 | AC | 53 ms
20,540 KB |
testcase_10 | AC | 52 ms
22,488 KB |
testcase_11 | AC | 52 ms
20,496 KB |
testcase_12 | AC | 52 ms
20,512 KB |
testcase_13 | AC | 52 ms
22,656 KB |
testcase_14 | AC | 53 ms
20,492 KB |
testcase_15 | AC | 52 ms
20,572 KB |
testcase_16 | AC | 53 ms
20,668 KB |
testcase_17 | AC | 52 ms
20,552 KB |
testcase_18 | AC | 52 ms
22,644 KB |
testcase_19 | AC | 52 ms
22,560 KB |
testcase_20 | AC | 52 ms
22,480 KB |
testcase_21 | AC | 51 ms
20,488 KB |
testcase_22 | AC | 52 ms
22,524 KB |
testcase_23 | AC | 52 ms
22,596 KB |
testcase_24 | AC | 52 ms
20,552 KB |
testcase_25 | AC | 51 ms
20,508 KB |
testcase_26 | AC | 53 ms
20,532 KB |
testcase_27 | AC | 52 ms
20,572 KB |
testcase_28 | AC | 52 ms
22,548 KB |
testcase_29 | AC | 51 ms
20,584 KB |
testcase_30 | AC | 53 ms
22,548 KB |
testcase_31 | AC | 52 ms
20,596 KB |
testcase_32 | AC | 54 ms
20,604 KB |
testcase_33 | AC | 50 ms
18,580 KB |
testcase_34 | AC | 51 ms
20,500 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; namespace Palindrome01 { class MainClass { static void Main(string[] args) { string sentence; int maxLength = 0; sentence = Console.ReadLine(); for (int i = 0; i < sentence.Length - 1; i++) { for (int j = i; j < sentence.Length; j++) { string temp = sentence.Substring(i, sentence.Length - j); int num = SearchPalidrome(temp, 0); if (num == sentence.Length) num -= 2; if (num > maxLength) maxLength = num; } } Console.WriteLine(maxLength); } static int SearchPalidrome(string sentence, int layer) { if (sentence.Length == 1) return ++layer; if (sentence.Length == 0) return layer; if (sentence[0] == sentence[sentence.Length - 1]) { string temp = sentence.Substring(1, sentence.Length - 2); return SearchPalidrome(temp, layer+=2); } return 0; } } }