結果

問題 No.171 スワップ文字列(Med)
ユーザー wotsushiwotsushi
提出日時 2017-01-27 22:06:29
言語 Ruby
(3.3.0)
結果
AC  
実行時間 84 ms / 1,000 ms
コード長 178 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 11,364 KB
実行使用メモリ 15,860 KB
最終ジャッジ日時 2023-08-25 03:50:03
合計ジャッジ時間 2,373 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,044 KB
testcase_01 AC 78 ms
15,044 KB
testcase_02 AC 80 ms
15,388 KB
testcase_03 AC 79 ms
15,124 KB
testcase_04 AC 80 ms
14,976 KB
testcase_05 AC 81 ms
15,468 KB
testcase_06 AC 83 ms
15,524 KB
testcase_07 AC 84 ms
15,860 KB
testcase_08 AC 84 ms
15,636 KB
testcase_09 AC 84 ms
15,668 KB
testcase_10 AC 79 ms
15,048 KB
testcase_11 AC 80 ms
15,220 KB
testcase_12 AC 81 ms
15,060 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

S = gets.chomp
def f(n)
  return (1..n).inject(:*)
end
m = Hash.new(0)
S.each_char do |s|
  m[s] += 1
end
ans = (f(S.size)/m.values.map {|r| f(r)}.inject(:*) - 1) % 573
puts ans
0