結果
問題 | No.273 回文分解 |
ユーザー |
![]() |
提出日時 | 2015-11-23 21:43:54 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 23 ms / 2,000 ms |
コード長 | 521 bytes |
コンパイル時間 | 1,818 ms |
コンパイル使用メモリ | 109,740 KB |
実行使用メモリ | 17,792 KB |
最終ジャッジ日時 | 2024-06-25 13:33:04 |
合計ジャッジ時間 | 3,780 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;class Program{static void Main(){string s = Console.ReadLine();int ans = 1;for (int i = 2; i < s.Length; i++){for (int j = 0; j <= s.Length - i; j++){for (int h = j; h <= j + (i - 1) / 2; h++){if (s[h] != s[2 * j + i - 1 - h]) break;else if (h == j + (i - 1) / 2) ans = i;}}}Console.WriteLine(ans);}}