結果
問題 | No.928 軽減税率? |
ユーザー |
![]() |
提出日時 | 2019-11-22 22:37:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 907 ms / 1,000 ms |
コード長 | 841 bytes |
コンパイル時間 | 1,498 ms |
コンパイル使用メモリ | 168,016 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-11 04:18:46 |
合計ジャッジ時間 | 11,644 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {int p, q, a;cin >> p >> q >> a;if (p == q) {if (a) {cout << (int)1e9 << '\n';} else {cout << 0 << '\n';}return 0;}if (p < q) {if (a) {cout << (int)1e9 << '\n';} else {int res = 1e9;long long x = 1;while (clock() * 1000 / CLOCKS_PER_SEC < 900) {res -= p * x / 100 == q * x / 100;++x;}cout << res << '\n';}return 0;}auto chk = [&](long long x) -> bool {return x * (100 + p) / 100 < x * (100 + q) / 100 + a;};int res = 0;for (int r = 1; r <= 100; ++r) {int ok = -1, ng = 1e7;while (ng - ok > 1) {int mid = (ok + ng) / 2;(chk(100 * mid + r) ? ok : ng) = mid;}res += ok + 1;}cout << res << '\n';}