結果
問題 | No.928 軽減税率? |
ユーザー |
![]() |
提出日時 | 2020-01-30 12:54:17 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 1,000 ms |
コード長 | 1,366 bytes |
コンパイル時間 | 903 ms |
コンパイル使用メモリ | 93,048 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-16 03:30:06 |
合計ジャッジ時間 | 1,942 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
ソースコード
#include<algorithm>#include<cmath>#include<cstdio>#include<functional>#include<iomanip>#include<iostream>#include<map>#include<queue>#include<set>#include<string>#include<utility>#include<vector>using namespace std;typedef long long ll;const ll mod = 1000000007;#define rep(i,n) for(int i=0;i<n;i++)#define repl(i,s,e) for(int i=s;i<e;i++)#define reple(i,s,e) for(int i=s;i<=e;i++)#define revrep(i,n) for(int i=n-1;i>=0;i--)#define all(x) (x).begin(),(x).end()ll P, Q, A;bool C(ll x){ll eatin = (100 + P) * x / 100;ll takeout = ((100 + Q) * x / 100) + (ll)A;return eatin < takeout;}int main(){const int MAX_N = 1000000000;cin >> P >> Q >> A;if (P == Q){if(A == 0)cout << 0 << endl;elsecout << MAX_N << endl;return 0;}//この値を境にxの挙動が変わる//0 <= x <= boundary ・・・ 店内の店外の代金の大小関係が入れ替わる//boundary <= x <= 10^9 ・・・ 店内の店外の代金の大小関係が一定//なので//0 <= x <= boundary ・・・ 全探索(10^6程度)。//boundary <= x <= 10^9 ・・・ x = 10^9のを調べて、全部足す。int boundary = 100 * (A + 1);ll count = 0;repl(i, 1, boundary){if (C(i)) count++;}if (C(MAX_N)) count += (ll)MAX_N - boundary + 1;cout << count << endl;return 0;}