結果

問題 No.667 Mice's Luck(ネズミ達の運)
コンテスト
ユーザー cs027983
提出日時 2018-03-24 03:27:20
言語 Ruby
(4.0.1)
コンパイル:
ruby -w -c _filename_
実行:
ruby _filename_
結果
AC  
実行時間 231 ms / 2,000 ms
コード長 404 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 57 ms
コンパイル使用メモリ 9,088 KB
実行使用メモリ 23,424 KB
最終ジャッジ日時 2026-03-11 07:12:50
合計ジャッジ時間 1,887 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #
raw source code

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 |a|
  if a == 'o'
    puts sprintf('%.13f', number_of_correct_answers / number_of_rats * 100)
    number_of_correct_answers -= 1
  else
    puts sprintf('%.13f', number_of_correct_answers / number_of_rats * 100)
  end
  number_of_rats -= 1
end
0