結果
問題 |
No.928 軽減税率?
|
ユーザー |
![]() |
提出日時 | 2019-11-23 21:11:10 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,041 bytes |
コンパイル時間 | 617 ms |
コンパイル使用メモリ | 83,000 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 07:02:24 |
合計ジャッジ時間 | 1,676 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 WA * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:54:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 54 | scanf("%d%d%d", &p, &q, &a); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*- * * 928.cc: No.928 軽減税率? - yukicoder */ #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<iostream> #include<string> #include<vector> #include<map> #include<set> #include<stack> #include<list> #include<queue> #include<deque> #include<algorithm> #include<numeric> #include<utility> #include<complex> #include<functional> using namespace std; /* constant */ const int MAX_X = 1000000000; /* typedef */ typedef long long ll; /* global variables */ /* subroutines */ inline ll f(int p, int x, int a = 0) { return (ll)(100 + p) * x / 100 + a; } /* main */ /* yp = (100+p)/100*x yq = (100+q)/100*x+a yp < yq -> (100+p)x < (100+q)x+100a -> (p-q)x < 100a -> x < 100a/(p-q) */ int main() { int p, q, a; scanf("%d%d%d", &p, &q, &a); int cnt = 0; if (f(p, MAX_X) < f(q, MAX_X, a)) cnt = MAX_X; else { int maxx = 100 * (a + 1); for (int x = 1; x <= maxx; x++) if (f(p, x) < f(q, x, a)) cnt++; } printf("%d\n", cnt); return 0; }