結果

問題 No.52 よくある文字列の問題
ユーザー 抹茶アイス抹茶アイス
提出日時 2023-07-28 09:36:18
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 58 ms / 5,000 ms
コード長 871 bytes
コンパイル時間 10,494 ms
コンパイル使用メモリ 167,528 KB
実行使用メモリ 182,068 KB
最終ジャッジ日時 2024-04-15 18:41:38
合計ジャッジ時間 9,754 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
28,544 KB
testcase_01 AC 46 ms
28,160 KB
testcase_02 AC 53 ms
31,616 KB
testcase_03 AC 46 ms
28,288 KB
testcase_04 AC 54 ms
31,232 KB
testcase_05 AC 53 ms
31,616 KB
testcase_06 AC 58 ms
31,448 KB
testcase_07 AC 46 ms
28,660 KB
testcase_08 AC 44 ms
28,276 KB
testcase_09 AC 44 ms
28,408 KB
testcase_10 AC 45 ms
182,068 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (98 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

namespace yukicoder
{
	public class Program
	{
		public static void Main()
		{
			var A = Console.ReadLine();
			var P = (int)Math.Pow(2, A.Length);
			var l = new List<string>();
            while (P > 0)
            {
				P--;
				var a = A;
				var p = Convert.ToString(P, 2);
				var b = "";
                while (p.Length < a.Length)
                {
					p = "0" + p;
                }
				for(var i = 0; i < p.Length; i++)
                {
                    switch (p[i])
                    {
						case '0':
							b += a[0];
							a = a.Remove(0, 1);
							break;
						case '1':
							b += a[a.Length - 1];
							a = a.Remove(a.Length-1, 1);
							break;
                    }
                }
				l.Add(b);
            }
			Console.WriteLine(l.Distinct().Count());
        }
	}
}
0