結果
問題 |
No.273 回文分解
|
ユーザー |
![]() |
提出日時 | 2015-12-07 22:53:49 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 553 bytes |
コンパイル時間 | 926 ms |
コンパイル使用メモリ | 112,920 KB |
実行使用メモリ | 27,004 KB |
最終ジャッジ日時 | 2024-12-23 13:12:51 |
合計ジャッジ時間 | 3,042 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 16 WA * 16 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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 = 0; 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; } } } Console.WriteLine (maxMatch.ToString ()); } } }