結果

問題 No.170 スワップ文字列(Easy)
ユーザー mencotton
提出日時 2018-02-18 16:49:28
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 26 ms / 5,000 ms
コード長 735 bytes
コンパイル時間 2,563 ms
コンパイル使用メモリ 104,448 KB
実行使用メモリ 18,048 KB
最終ジャッジ日時 2024-06-25 05:16:31
合計ジャッジ時間 4,119 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;

namespace _170
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            Dictionary<char,int> dic = new Dictionary<char,int>();
            for (int i = 0; i < s.Length; i++)
            {
                if (!dic.ContainsKey(s[i])) dic[s[i]] = 0;
                dic[s[i]]++;
            }
            long ret = 1;
            for (int i = 1; i <= s.Length; i++) ret *= i;
            foreach (var item in dic)
            {
                int a = 1;
                for (int i = 1; i <= item.Value; i++) a *= i;
                ret /= a;
            }
            Console.WriteLine(ret - 1);
        }
    }
}
0