結果

問題 No.238 Mr. K's Another Gift
ユーザー NoNo
提出日時 2017-05-24 21:01:21
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,519 bytes
コンパイル時間 1,241 ms
コンパイル使用メモリ 109,600 KB
実行使用メモリ 26,108 KB
最終ジャッジ日時 2023-10-19 20:24:45
合計ジャッジ時間 5,236 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
24,440 KB
testcase_01 AC 28 ms
24,808 KB
testcase_02 AC 27 ms
24,880 KB
testcase_03 AC 28 ms
24,876 KB
testcase_04 AC 24 ms
24,408 KB
testcase_05 WA -
testcase_06 AC 25 ms
24,408 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 26 ms
24,808 KB
testcase_11 AC 27 ms
24,868 KB
testcase_12 AC 26 ms
24,880 KB
testcase_13 AC 27 ms
24,884 KB
testcase_14 AC 29 ms
25,128 KB
testcase_15 AC 32 ms
26,012 KB
testcase_16 AC 32 ms
26,012 KB
testcase_17 AC 32 ms
26,012 KB
testcase_18 AC 32 ms
26,012 KB
testcase_19 AC 31 ms
26,016 KB
testcase_20 AC 26 ms
24,800 KB
testcase_21 AC 26 ms
24,864 KB
testcase_22 AC 24 ms
24,440 KB
testcase_23 AC 27 ms
24,876 KB
testcase_24 AC 27 ms
24,880 KB
testcase_25 AC 28 ms
24,880 KB
testcase_26 AC 25 ms
24,408 KB
testcase_27 WA -
testcase_28 AC 25 ms
24,408 KB
testcase_29 WA -
testcase_30 AC 27 ms
24,864 KB
testcase_31 AC 27 ms
24,880 KB
testcase_32 AC 27 ms
24,876 KB
testcase_33 AC 28 ms
24,880 KB
testcase_34 AC 31 ms
25,852 KB
testcase_35 AC 32 ms
26,012 KB
testcase_36 AC 32 ms
26,012 KB
testcase_37 AC 33 ms
26,012 KB
testcase_38 AC 32 ms
26,012 KB
testcase_39 AC 32 ms
26,016 KB
testcase_40 AC 27 ms
24,864 KB
testcase_41 AC 23 ms
24,440 KB
testcase_42 AC 27 ms
24,864 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;

namespace Yuki
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int i = 0;
            int j = s.Length - 1;
            int c = -1;
            int d = -1;

            bool f = true;
            while (i <= j)
            {
                if (s[i] != s[j])
                {
                    c = i;
                    d = j;
                    f = false;
                    break;
                }
                i++;
                j--;
            }

            if (f)
            {
                Console.Write(s.Insert(s.Length / 2, s[s.Length / 2].ToString()));
            }
            else
            {
                string a = s.Insert(c, s[d].ToString());
                string b = "";
                if (c == 0)
                {
                    b = s + s[0];
                }
                else
                {
                    b = s.Insert(d, s[c].ToString());
                }
                string a2 = new string(a.Reverse().ToArray());
                string b2 = new string(b.Reverse().ToArray());


                if (a == a2)
                {
                    Console.WriteLine(a);
                }
                else if (b == b2)
                {
                    Console.WriteLine(b);
                }
                else
                {
                    Console.WriteLine("NA");
                }
            }
        }
    }
}
0