結果
| 問題 | No.52 よくある文字列の問題 | 
| コンテスト | |
| ユーザー |  aketijyuuzou | 
| 提出日時 | 2024-10-10 22:00:42 | 
| 言語 | C#(csc) (csc 3.9.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 30 ms / 5,000 ms | 
| コード長 | 1,943 bytes | 
| コンパイル時間 | 1,291 ms | 
| コンパイル使用メモリ | 113,524 KB | 
| 実行使用メモリ | 20,224 KB | 
| 最終ジャッジ日時 | 2024-10-10 22:00:44 | 
| 合計ジャッジ時間 | 1,928 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 11 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
class Program
{
    static string InputPattern = "InputX";
    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();
        if (InputPattern == "Input1") {
            WillReturn.Add("abc");
            //4
            //abc、acb、cab、cbaの4通りがある
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("aab");
            //3
            //aab、aba、baaの3通りがある
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("aaaaaaaaaa");
            //1
            //どのようにしてもaaaaaaaaaaにしかならない
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }
    struct JyoutaiDef
    {
        internal string CurrStr;
        internal string CreateStr;
    }
    static void Main()
    {
        List<string> InputList = GetInputList();
        string S = InputList[0];
        var stk = new Stack<JyoutaiDef>();
        JyoutaiDef WillPush;
        WillPush.CurrStr = S;
        WillPush.CreateStr = "";
        stk.Push(WillPush);
        var CreateStrSet = new HashSet<string>();
        while (stk.Count > 0) {
            JyoutaiDef Popped = stk.Pop();
            //クリア判定
            if (Popped.CurrStr == "") {
                CreateStrSet.Add(Popped.CreateStr);
                continue;
            }
            Action<int> PushSyori = pRemoveInd =>
            {
                WillPush.CurrStr = Popped.CurrStr.Remove(pRemoveInd, 1);
                WillPush.CreateStr = Popped.CreateStr + Popped.CurrStr[pRemoveInd];
                stk.Push(WillPush);
            };
            PushSyori(0);
            PushSyori(Popped.CurrStr.Length - 1);
        }
        Console.WriteLine(CreateStrSet.Count);
    }
}
            
            
            
        