結果

問題 No.928 軽減税率?
ユーザー risujirohrisujiroh
提出日時 2019-11-22 22:28:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 735 bytes
コンパイル時間 1,518 ms
コンパイル使用メモリ 166,012 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-11 04:13:52
合計ジャッジ時間 15,435 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
  }
  auto chk = [&](long long x) -> bool {
    return x * (100 + p) / 100 < x * (100 + q) / 100 + a;
  };
  if (p < q) {
    int res = 0;
    int x = 1;
    while (clock() * 1000 / CLOCKS_PER_SEC < 990) {
      res += chk(x);
      ++x;
    }
    cout << res << '\n';
    return 0;
  }
  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';
}
0