結果

問題 No.238 Mr. K's Another Gift
ユーザー NoNo
提出日時 2017-05-24 20:39:02
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,253 bytes
コンパイル時間 3,289 ms
コンパイル使用メモリ 109,312 KB
実行使用メモリ 25,608 KB
最終ジャッジ日時 2023-10-19 20:21:50
合計ジャッジ時間 6,055 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
24,456 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 24 ms
24,436 KB
testcase_05 WA -
testcase_06 AC 25 ms
24,436 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 26 ms
24,812 KB
testcase_11 AC 26 ms
24,812 KB
testcase_12 AC 26 ms
24,828 KB
testcase_13 AC 26 ms
24,808 KB
testcase_14 AC 31 ms
24,808 KB
testcase_15 AC 31 ms
25,532 KB
testcase_16 AC 31 ms
25,532 KB
testcase_17 AC 31 ms
25,532 KB
testcase_18 AC 31 ms
25,532 KB
testcase_19 AC 31 ms
25,532 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 24 ms
24,456 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 26 ms
24,436 KB
testcase_27 WA -
testcase_28 AC 25 ms
24,436 KB
testcase_29 WA -
testcase_30 AC 26 ms
24,804 KB
testcase_31 AC 26 ms
24,824 KB
testcase_32 AC 27 ms
24,828 KB
testcase_33 AC 27 ms
24,808 KB
testcase_34 AC 30 ms
25,416 KB
testcase_35 AC 31 ms
25,532 KB
testcase_36 AC 30 ms
25,532 KB
testcase_37 AC 31 ms
25,532 KB
testcase_38 AC 31 ms
25,532 KB
testcase_39 AC 30 ms
25,532 KB
testcase_40 WA -
testcase_41 AC 24 ms
24,456 KB
testcase_42 AC 26 ms
24,804 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());
                if (s.ToArray<char>() == b.Reverse<char>())
                {
                    Console.WriteLine(a);
                }else if (s.ToArray<char>() == b.Reverse<char>())
                {
                    Console.WriteLine(b);
                }
                else
                {
                    Console.WriteLine("NA");
                }
            }
        }
    }
}
0