結果
| 問題 |
No.928 軽減税率?
|
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2023-04-18 23:16:01 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 376 bytes |
| コンパイル時間 | 45 ms |
| コンパイル使用メモリ | 7,296 KB |
| 実行使用メモリ | 12,416 KB |
| 最終ジャッジ日時 | 2024-10-13 23:10:59 |
| 合計ジャッジ時間 | 6,324 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 10 WA * 24 |
コンパイルメッセージ
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) do |x|
ans += 1 if f(x)
end
puts ans
else
puts 0
end
siman