結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using usize = std::size_t;
int main()
{
    constexpr usize max = 1000000000;
    usize p, q, a;
    std::cin >> p >> q >> a;
    if (p < q) { return std::cout << max << std::endl, 0; }
    if (p == q) { return std::cout << (a == 0 ? 0 : max) << std::endl, 0; }
    const usize l = (a <= 1 ? 0 : (100UL * a - 100UL) / (p - q));
    const usize r = (100UL * a + p - q - 1) / (p - q);
    usize ans     = l;
    for (usize x = l + 1; x < r; x++) {
        const usize eat_in   = x * p / 100;
        const usize take_out = x * q / 100 + a;
        if (eat_in < take_out) { ans++; }
    }
    std::cout << ans << std::endl;
    return 0;
}
0