結果

問題 No.1904 Never giving up!
ユーザー simansiman
提出日時 2022-04-16 04:34:58
言語 Ruby
(3.3.0)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 264 bytes
コンパイル時間 396 ms
コンパイル使用メモリ 11,392 KB
実行使用メモリ 15,300 KB
最終ジャッジ日時 2023-08-26 14:17:28
合計ジャッジ時間 2,204 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,180 KB
testcase_01 AC 83 ms
15,120 KB
testcase_02 AC 83 ms
15,072 KB
testcase_03 AC 82 ms
15,268 KB
testcase_04 AC 81 ms
15,080 KB
testcase_05 AC 83 ms
15,148 KB
testcase_06 AC 83 ms
15,300 KB
testcase_07 AC 83 ms
15,080 KB
testcase_08 AC 83 ms
15,280 KB
testcase_09 AC 83 ms
15,260 KB
testcase_10 AC 82 ms
15,264 KB
testcase_11 AC 83 ms
15,072 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
A = gets.split.map(&:to_i).sort
ptn_cnt = 1

until A.empty?
  v = A.shift
  cnt = 1

  while A.size > 0 && v == A.first
    A.shift
    cnt += 1
  end

  ptn_cnt *= (1..cnt).inject(:*)
end

puts Rational(1, Rational(ptn_cnt, (1..N).inject(:*))).to_i
0