結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
24,512 KB
testcase_01 AC 27 ms
24,872 KB
testcase_02 AC 27 ms
24,956 KB
testcase_03 AC 28 ms
24,964 KB
testcase_04 AC 24 ms
24,492 KB
testcase_05 WA -
testcase_06 AC 25 ms
24,492 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 27 ms
24,872 KB
testcase_11 AC 27 ms
24,956 KB
testcase_12 AC 27 ms
24,964 KB
testcase_13 AC 27 ms
24,952 KB
testcase_14 AC 30 ms
25,216 KB
testcase_15 AC 33 ms
26,100 KB
testcase_16 AC 33 ms
26,100 KB
testcase_17 AC 33 ms
26,100 KB
testcase_18 AC 32 ms
26,100 KB
testcase_19 AC 32 ms
26,100 KB
testcase_20 AC 27 ms
24,896 KB
testcase_21 WA -
testcase_22 AC 24 ms
24,512 KB
testcase_23 AC 28 ms
24,964 KB
testcase_24 AC 28 ms
24,952 KB
testcase_25 AC 29 ms
24,952 KB
testcase_26 AC 26 ms
24,492 KB
testcase_27 WA -
testcase_28 AC 26 ms
24,492 KB
testcase_29 WA -
testcase_30 AC 27 ms
24,956 KB
testcase_31 AC 27 ms
24,956 KB
testcase_32 AC 28 ms
24,964 KB
testcase_33 AC 28 ms
24,952 KB
testcase_34 AC 32 ms
25,936 KB
testcase_35 AC 32 ms
26,100 KB
testcase_36 AC 33 ms
26,100 KB
testcase_37 AC 32 ms
26,100 KB
testcase_38 AC 33 ms
26,100 KB
testcase_39 AC 33 ms
26,100 KB
testcase_40 WA -
testcase_41 AC 24 ms
24,512 KB
testcase_42 AC 27 ms
24,956 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 = 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