結果
| 問題 |
No.928 軽減税率?
|
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2023-04-18 23:17:06 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 391 bytes |
| コンパイル時間 | 167 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 12,544 KB |
| 最終ジャッジ日時 | 2024-10-13 23:11:53 |
| 合計ジャッジ時間 | 5,821 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 14 WA * 20 |
コンパイルメッセージ
Syntax OK
ソースコード
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, 10 ** 9].min) do |x|
ans += 1 if f(x)
end
puts ans
else
puts 0
end
siman