結果
| 問題 |
No.238 Mr. K's Another Gift
|
| コンテスト | |
| ユーザー |
No
|
| 提出日時 | 2017-05-24 21:01:21 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,519 bytes |
| コンパイル時間 | 837 ms |
| コンパイル使用メモリ | 110,856 KB |
| 実行使用メモリ | 30,128 KB |
| 最終ジャッジ日時 | 2024-09-19 16:29:36 |
| 合計ジャッジ時間 | 4,325 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 WA * 6 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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");
}
}
}
}
}
No