結果
問題 | No.928 軽減税率? |
ユーザー |
![]() |
提出日時 | 2019-11-22 21:42:43 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 557 bytes |
コンパイル時間 | 1,771 ms |
コンパイル使用メモリ | 166,276 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 03:08:29 |
合計ジャッジ時間 | 7,357 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 WA * 12 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int p, q, a; cin >> p >> q >> a; if (p <= q) { cout << (int)1e9 << '\n'; return 0; } auto chk = [&](long long x) -> bool { return x * (100 + p) / 100 < x * (100 + q) / 100 + a; }; int ok = 0, ng = 1e9 + 1; while (ng - ok > 1) { int mid = (ok + ng) / 2; (chk(mid) ? ok : ng) = mid; } const int w = 1e8; int l = max(ok - w, 1), u = min<int>(ok + w, 1e9); int res = (l - 1); for (int x = l; x <= u; ++x) { res += chk(x); } cout << res << '\n'; }