結果

問題 No.170 スワップ文字列(Easy)
ユーザー NoNo
提出日時 2015-06-12 17:07:58
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 58 ms / 5,000 ms
コード長 1,221 bytes
コンパイル時間 2,300 ms
コンパイル使用メモリ 107,160 KB
実行使用メモリ 23,592 KB
最終ジャッジ日時 2023-08-24 16:20:04
合計ジャッジ時間 4,814 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
23,592 KB
testcase_01 AC 56 ms
21,432 KB
testcase_02 AC 55 ms
21,360 KB
testcase_03 AC 55 ms
21,492 KB
testcase_04 AC 57 ms
23,440 KB
testcase_05 AC 57 ms
19,500 KB
testcase_06 AC 57 ms
21,392 KB
testcase_07 AC 56 ms
19,476 KB
testcase_08 AC 56 ms
21,340 KB
testcase_09 AC 56 ms
21,340 KB
testcase_10 AC 56 ms
21,420 KB
testcase_11 AC 55 ms
21,492 KB
testcase_12 AC 56 ms
21,484 KB
testcase_13 AC 57 ms
21,500 KB
testcase_14 AC 55 ms
21,400 KB
testcase_15 AC 58 ms
23,520 KB
testcase_16 AC 56 ms
23,492 KB
testcase_17 AC 56 ms
23,456 KB
testcase_18 AC 57 ms
23,456 KB
testcase_19 AC 57 ms
21,348 KB
testcase_20 AC 57 ms
23,568 KB
testcase_21 AC 56 ms
23,504 KB
testcase_22 AC 56 ms
21,464 KB
testcase_23 AC 56 ms
21,340 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;
using System.Text;
using System.Threading.Tasks;

namespace foryuki
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] c = Console.ReadLine().ToCharArray();

            int a = 1;
            for (int i = 1; i <= c.Length; i++)
            {
                a *= i;
            }

            int b = 1;
            var q1 = c.Distinct();
            foreach (var i in q1)
            {
                int k = c.Where(x => x == i).Count();
                for (int j = 1; j <= k; j++)
                {
                    b *= j;
                }
            }

            Console.WriteLine((a / b) - 1);
        }

        //-------------------------------------------------------------

        static int[] ConvertStringArrayToIntArray(string[] array)
        {
            return Array.ConvertAll(array, str => int.Parse(str));
        }

        static List<int> ConvertStringArrayToIntList(string[] str)
        {
            var list = new List<int>();
            foreach (var c in str)
            {
                list.Add(int.Parse(c));
            }
            return list;
        }
    }
}
0