結果

問題 No.667 Mice's Luck(ネズミ達の運)
ユーザー cs027983cs027983
提出日時 2018-03-24 03:56:43
言語 Ruby
(3.3.0)
結果
AC  
実行時間 306 ms / 2,000 ms
コード長 316 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 11,448 KB
実行使用メモリ 24,736 KB
最終ジャッジ日時 2023-09-07 08:19:56
合計ジャッジ時間 2,858 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,204 KB
testcase_01 AC 80 ms
15,040 KB
testcase_02 AC 80 ms
15,128 KB
testcase_03 AC 79 ms
15,200 KB
testcase_04 AC 85 ms
15,072 KB
testcase_05 AC 105 ms
16,608 KB
testcase_06 AC 192 ms
21,292 KB
testcase_07 AC 306 ms
24,736 KB
testcase_08 AC 268 ms
24,732 KB
testcase_09 AC 252 ms
24,216 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

places = gets.to_s.chomp!.split('')
number_of_rats = places.size.to_f
number_of_correct_answers = places.select { |p| p if p == 'o' }.size.to_f

places.each do |place|
  puts sprintf('%.13f', number_of_correct_answers / number_of_rats * 100)
  number_of_correct_answers -= 1 if place == 'o'
  number_of_rats -= 1
end
0