結果

問題 No.170 スワップ文字列(Easy)
ユーザー mban
提出日時 2016-11-18 19:23:28
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 26 ms / 5,000 ms
コード長 821 bytes
コンパイル時間 863 ms
コンパイル使用メモリ 103,040 KB
実行使用メモリ 18,176 KB
最終ジャッジ日時 2024-12-23 00:44:42
合計ジャッジ時間 2,251 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;

public class Magatro
{
    static void Main()
    {
        List<int> C = new List<int>();
        string s = Console.ReadLine();
        string w = s;
        while (s.Length > 0)
        {
            string q = s.Replace(s[0].ToString(), "");
            C.Add(s.Length - q.Length);
            s = q;
        }
        int ans = kaizyou(w.Length);
        for(int i = 0; i < C.Count; i++)
        {
            ans /= kaizyou(C[i]);
        }
        Console.WriteLine(ans-1);
    }
    static int kaizyou(int n)
    {
        if (n == 0)
        {
            return 1;
        }
        return n * (kaizyou(n - 1));
    }
}


0