結果
問題 |
No.588 空白と回文
|
ユーザー |
|
提出日時 | 2017-11-14 13:01:59 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 978 bytes |
コンパイル時間 | 946 ms |
コンパイル使用メモリ | 108,160 KB |
実行使用メモリ | 25,928 KB |
最終ジャッジ日時 | 2024-11-25 02:02:45 |
合計ジャッジ時間 | 2,170 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 WA * 9 |
コンパイルメッセージ
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; using System.Threading.Tasks; namespace SpaceEscape { class Program { static void Main(string[] args) { string target = Console.ReadLine(); Console.WriteLine(checkAnagram(target)); } static int checkAnagram(string str) { int max_count = 0; // max count for anagram word for (int i = 0; i < str.Length; i++) { int count = 0; // count for anagram word for (int j = 1; j < str.Length; j++) { if (i + j >= str.Length || i - j < 0) break; if (str[i + j] == str[i - j]) count++; } if (max_count < count) max_count = count; } return max_count * 2 + 1; } } }