結果

問題 No.928 軽減税率?
ユーザー kimiyuki
提出日時 2019-11-22 22:03:41
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 714 bytes
コンパイル時間 1,799 ms
コンパイル使用メモリ 193,628 KB
最終ジャッジ日時 2025-01-08 05:01:25
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 32 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
using namespace std;

int solve(int p, int q, int a) {
    constexpr int N = 1e9;
    int cnt = 0;
    if (p <= q) {
        if (a >= 1) {
            cnt = N;
        } else {
            constexpr int L = 100000;
            REP3 (x, 1, L) {
                cnt += (p * x / 100 < q * x / 100 + a);
            }
            cnt += N + 1 - L;
        }
    } else {
        REP3 (x, 1, N + 1) {
            cnt += (p * x / 100 < q * x / 100 + a);
            if (cnt + 10000 < x) break;
        }
    }
    return cnt;
}

int main() {
    int p, q, a; cin >> p >> q >> a;
    cout << solve(p, q, a) << endl;
    return 0;
}
0