結果

問題 No.170 スワップ文字列(Easy)
ユーザー mai
提出日時 2016-02-02 19:53:39
言語 Ruby
(3.4.1)
結果
AC  
実行時間 98 ms / 5,000 ms
コード長 222 bytes
コンパイル時間 66 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-12-23 00:35:47
合計ジャッジ時間 3,215 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def fact(x);(1..x).inject(:*);end
s=gets.chars.to_a.sort!.select{|e|e.match(/[A-Z]/)}
a=[1]
s.inject(){|m,e|
    if m==e
        a[-1]+=1
    else
        a+=[1]
    end
    m=e
}
n=fact(s.size)
a.each{|e|n/=fact(e)}
p n-1
0