結果
問題 | No.667 Mice's Luck(ネズミ達の運) |
ユーザー | gemmaro |
提出日時 | 2020-02-20 09:13:37 |
言語 | Ruby (3.3.0) |
結果 |
AC
|
実行時間 | 443 ms / 2,000 ms |
コード長 | 430 bytes |
コンパイル時間 | 44 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 23,168 KB |
最終ジャッジ日時 | 2024-04-17 06:18:26 |
合計ジャッジ時間 | 3,856 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 87 ms
12,160 KB |
testcase_01 | AC | 89 ms
12,288 KB |
testcase_02 | AC | 86 ms
12,160 KB |
testcase_03 | AC | 87 ms
12,288 KB |
testcase_04 | AC | 96 ms
12,160 KB |
testcase_05 | AC | 124 ms
12,800 KB |
testcase_06 | AC | 261 ms
15,872 KB |
testcase_07 | AC | 443 ms
23,168 KB |
testcase_08 | AC | 277 ms
23,168 KB |
testcase_09 | AC | 265 ms
22,528 KB |
コンパイルメッセージ
Syntax OK
ソースコード
# frozen_string_literal: true EPS = 10**-6 S = gets.chomp.chars.map { |safe| safe == 'o' } SAFE_NUM = S.select { |i| i }.size remains = Array.new(S.size, 0) remains[0] = SAFE_NUM S[0..-2].each_with_index do |safe, index| remains[index + 1] = remains[index] remains[index + 1] -= 1 if safe end PROBS = remains.map.with_index do |remain, index| blanks = S.size - index Rational(remain, blanks).to_f * 100 end puts PROBS