結果

問題 No.928 軽減税率?
ユーザー simansiman
提出日時 2023-04-18 23:16:01
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 376 bytes
コンパイル時間 54 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,544 KB
最終ジャッジ日時 2024-04-22 00:38:18
合計ジャッジ時間 6,647 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 168 ms
12,544 KB
testcase_01 AC 165 ms
12,288 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 172 ms
12,288 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 172 ms
12,416 KB
testcase_08 AC 175 ms
12,288 KB
testcase_09 WA -
testcase_10 AC 168 ms
12,288 KB
testcase_11 AC 170 ms
12,544 KB
testcase_12 WA -
testcase_13 AC 160 ms
12,288 KB
testcase_14 AC 173 ms
12,288 KB
testcase_15 WA -
testcase_16 AC 176 ms
12,288 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 89 ms
12,288 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 91 ms
12,160 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

P, Q, A = gets.split.map(&:to_i)

def f(x)
  (x + Rational(P * x, 100).floor) < (x + Rational(Q * x, 100).floor) + A
end

if f(1)
  ok = 1
  ng = 10 ** 9 + 1

  while (ok - ng).abs >= 2
    x = (ok + ng) / 2

    if f(x)
      ok = x
    else
      ng = x
    end
  end

  ans = ok
  (ok + 1).upto(ok + 100_000) do |x|
    ans += 1 if f(x)
  end

  puts ans
else
  puts 0
end
0