結果

問題 No.221 犯罪都市
ユーザー tshigtshig
提出日時 2016-08-18 14:26:40
言語 Ruby
(3.3.0)
結果
AC  
実行時間 82 ms / 5,000 ms
コード長 368 bytes
コンパイル時間 38 ms
コンパイル使用メモリ 11,240 KB
実行使用メモリ 15,300 KB
最終ジャッジ日時 2023-08-26 13:59:44
合計ジャッジ時間 2,055 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,244 KB
testcase_01 AC 76 ms
15,132 KB
testcase_02 AC 76 ms
15,296 KB
testcase_03 AC 76 ms
15,300 KB
testcase_04 AC 74 ms
15,296 KB
testcase_05 AC 75 ms
15,292 KB
testcase_06 AC 75 ms
15,168 KB
testcase_07 AC 76 ms
15,060 KB
testcase_08 AC 76 ms
15,088 KB
testcase_09 AC 75 ms
15,164 KB
testcase_10 AC 76 ms
15,260 KB
testcase_11 AC 80 ms
15,160 KB
testcase_12 AC 76 ms
15,244 KB
testcase_13 AC 75 ms
15,056 KB
testcase_14 AC 75 ms
15,284 KB
testcase_15 AC 76 ms
15,056 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

class Calc0221
  EPS = 1e-2

  def initialize(args)
    args = args.map { |l| l.chomp.split(/\s+/) }
    @n = args.shift.first.to_i
  end

  def run
    return 100 if @n == 0
    nm = 100 * @n
    nc = 1_000_000 - nm
    pa = 0.99 * nm / @n + 0.01 * nc / @n
    pb = 0.01 * nc / @n
    pb / pa * 100
  end
end

puts Calc0221.new(STDIN.readlines).run if __FILE__ == $0
0