結果

問題 No.52 よくある文字列の問題
ユーザー NoNo
提出日時 2018-01-27 16:39:02
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 27 ms / 5,000 ms
コード長 796 bytes
コンパイル時間 2,836 ms
コンパイル使用メモリ 109,908 KB
実行使用メモリ 25,304 KB
最終ジャッジ日時 2023-10-22 04:13:04
合計ジャッジ時間 3,595 ms
ジャッジサーバーID
(参考情報)
judge12 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
25,240 KB
testcase_01 AC 25 ms
25,240 KB
testcase_02 AC 26 ms
25,304 KB
testcase_03 AC 26 ms
25,240 KB
testcase_04 AC 26 ms
25,296 KB
testcase_05 AC 27 ms
25,296 KB
testcase_06 AC 27 ms
25,296 KB
testcase_07 AC 26 ms
25,296 KB
testcase_08 AC 26 ms
25,304 KB
testcase_09 AC 26 ms
25,236 KB
testcase_10 AC 25 ms
25,296 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.Collections.Generic;
using System.Linq;

namespace y
{
    class Program
    {
        static void Main(string[] args)
        {
            var li1 = new List<string>();
            var s = Console.ReadLine();
            li1.Add("," + s);

            for (int i = 0; i < s.Length; i++)
            {
                var li2 = new List<string>();
                foreach (var item in li1)
                {
                    string[] ss = item.Split(',');
                    li2.Add(ss[0] + ss[1][0] + "," + ss[1].Remove(0,1));
                    li2.Add(ss[0] + ss[1][ss[1].Length - 1] + "," + ss[1].Remove(ss[1].Length - 1, 1));
                }
                li1 = li2;
            }

            Console.WriteLine(li1.Distinct().Count());
        }
    }
}
0