結果
問題 | No.238 Mr. K's Another Gift |
ユーザー | nokonoko |
提出日時 | 2015-07-05 23:39:09 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 120 ms / 2,000 ms |
コード長 | 4,993 bytes |
コンパイル時間 | 4,467 ms |
コンパイル使用メモリ | 108,556 KB |
実行使用メモリ | 23,716 KB |
最終ジャッジ日時 | 2023-09-22 08:44:12 |
合計ジャッジ時間 | 8,088 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 53 ms
21,216 KB |
testcase_01 | AC | 52 ms
21,448 KB |
testcase_02 | AC | 52 ms
21,356 KB |
testcase_03 | AC | 52 ms
21,560 KB |
testcase_04 | AC | 54 ms
21,248 KB |
testcase_05 | AC | 55 ms
21,340 KB |
testcase_06 | AC | 54 ms
21,676 KB |
testcase_07 | AC | 55 ms
21,440 KB |
testcase_08 | AC | 55 ms
23,560 KB |
testcase_09 | AC | 55 ms
23,716 KB |
testcase_10 | AC | 51 ms
21,368 KB |
testcase_11 | AC | 51 ms
23,312 KB |
testcase_12 | AC | 51 ms
23,408 KB |
testcase_13 | AC | 53 ms
23,308 KB |
testcase_14 | AC | 54 ms
21,288 KB |
testcase_15 | AC | 54 ms
23,432 KB |
testcase_16 | AC | 53 ms
23,312 KB |
testcase_17 | AC | 52 ms
19,320 KB |
testcase_18 | AC | 53 ms
21,464 KB |
testcase_19 | AC | 54 ms
23,348 KB |
testcase_20 | AC | 52 ms
21,344 KB |
testcase_21 | AC | 51 ms
23,252 KB |
testcase_22 | AC | 51 ms
23,416 KB |
testcase_23 | AC | 52 ms
23,272 KB |
testcase_24 | AC | 52 ms
21,272 KB |
testcase_25 | AC | 120 ms
21,348 KB |
testcase_26 | AC | 57 ms
21,568 KB |
testcase_27 | AC | 57 ms
21,660 KB |
testcase_28 | AC | 55 ms
21,680 KB |
testcase_29 | AC | 55 ms
21,656 KB |
testcase_30 | AC | 52 ms
19,164 KB |
testcase_31 | AC | 51 ms
21,140 KB |
testcase_32 | AC | 51 ms
21,224 KB |
testcase_33 | AC | 52 ms
23,244 KB |
testcase_34 | AC | 53 ms
21,332 KB |
testcase_35 | AC | 53 ms
21,444 KB |
testcase_36 | AC | 53 ms
21,224 KB |
testcase_37 | AC | 54 ms
21,320 KB |
testcase_38 | AC | 55 ms
21,400 KB |
testcase_39 | AC | 54 ms
23,308 KB |
testcase_40 | AC | 53 ms
23,240 KB |
testcase_41 | AC | 52 ms
21,324 KB |
testcase_42 | AC | 52 ms
21,328 KB |
コンパイルメッセージ
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; namespace YukiCoderNo238 { class Program { static void Main() { string input = LIB.IO.R<string>(); char[] inputarray = input.ToCharArray(); int count = inputarray.Count(); bool flag = false; bool ba = false; int mem = 0; char c = ' '; for (int i = 0, j = count - 1; i < count / 2 + count % 2; i++, j--) { if (inputarray[i] != inputarray[j]) { if (flag == true) { flag = false; ba = true; for (int k = 0, l = count - 1; k < count / 2; k++, l--) { if (inputarray[k] != inputarray[l]) { if (flag == true) { LIB.IO.W("NA"); LIB.IO.WFLUSH(); return; } else { flag = true; mem = k; c = inputarray[l]; k--; } } } } else { flag = true; mem = j; c = inputarray[i]; j++; } } } if (flag == true) { if (ba == false) { LIB.IO.W(new string(inputarray, 0, mem + 1), false); LIB.IO.W(c, false); if (mem < count - 1) { LIB.IO.W(new string(inputarray, mem + 1, count - mem - 1), false); } LIB.IO.W(""); } else { LIB.IO.W(new string(inputarray, 0, mem), false); LIB.IO.W(c, false); if (mem < count - 1) { LIB.IO.W(new string(inputarray, mem, count - mem), false); } LIB.IO.W(""); } } else { if ((count % 2) == 0) { LIB.IO.W(new string(inputarray, 0, count / 2), false); LIB.IO.W('a', false); LIB.IO.W(new string(inputarray, count / 2, count / 2), false); LIB.IO.W(""); } else { if (count == 1) { LIB.IO.W(inputarray[0], false); LIB.IO.W(inputarray[0], false); } else { LIB.IO.W(new string(inputarray, 0, count / 2), false); LIB.IO.W(inputarray[count / 2], false); LIB.IO.W(new string(inputarray, count / 2 , count / 2 + 1), false); } LIB.IO.W(""); } } LIB.IO.WFLUSH(); } } } namespace LIB { public class IO { private const int WMAX = 1000; private static string WSTRING = ""; public static T R<T>() { return (T)(Convert.ChangeType(R(), typeof(T))); } public static T[] R<T>(char splitter = ' ') { return R().Split(splitter).Select(v => UTILITY.PARSE<T>(v)).ToArray(); } public static T[] R<T>(int length) { T[] ret = new T[length]; for (int i = 0; i < length; i++) { ret[i] = R<T>(); } return ret; } public static T[][] R<T>(int length, char splitter = ' ') { T[][] ret = new T[length][]; for (int i = 0; i < length; i++) { ret[i] = R<T>(splitter); } return ret; } private static string R() { return Console.ReadLine(); } public static void W(object value, bool addLineFeed = true) { WSTRING += UTILITY.PARSE<string>(value); if (addLineFeed == true) { WSTRING += "\n"; } if (WSTRING.Count() >= WMAX) { WFLUSH(); } } public static void WFLUSH() { Console.Write(WSTRING); WSTRING = ""; } } public class UTILITY { public static T PARSE<T>(object value) { return (T)(Convert.ChangeType(value, typeof(T))); } } }