結果

問題 No.928 軽減税率?
ユーザー YamaKasa
提出日時 2019-12-25 02:23:36
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 1,000 ms
コード長 1,090 bytes
コンパイル時間 1,582 ms
コンパイル使用メモリ 167,848 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-22 21:24:54
合計ジャッジ時間 2,624 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll my_pow(ll x, ll n) {
    if (n == 0) return 1;
    if (n % 2 == 0) return my_pow(x * x, n / 2);
    return x * my_pow(x, n - 1);
}

int main() {
    ll P, Q, A;
    cin >> P >> Q >> A;
    ll t = my_pow(10, 9);
    if (P == Q) {
        if (A == 0) {
            cout << "0\n";
        } else {
            cout << t << "\n";
        }
        return 0;
    }
    if (Q < P && A == 0) {
        cout << "0\n";
        return 0;
    }
    if (P < Q) {
        if (A != 0) {
            cout << t << "\n";
        } else {
            int k = 0;
            for (ll x = 1; x <= 99; x++) {
                ll p = (100 + P) * x / 100;
                ll q = (100 + Q) * x / 100 + A;
                if (p >= q) k++;
            }
            cout << t - k << "\n";
        }
        return 0;
    }


    int cnt = 0;
    for (ll x = 1; x <= 100 * (A - 1) + 99; x++) {
        ll p = (100 + P) * x / 100;
        ll q = (100 + Q) * x / 100 + A;
        if (p < q) cnt++;
    }
    
    cout << cnt << "\n";
    return 0;
}
0