結果
問題 | No.928 軽減税率? |
ユーザー |
![]() |
提出日時 | 2019-11-23 21:14:39 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 5 ms / 1,000 ms |
コード長 | 1,032 bytes |
コンパイル時間 | 1,007 ms |
コンパイル使用メモリ | 83,256 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 07:02:20 |
合計ジャッジ時間 | 1,994 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
コンパイルメッセージ
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*xyq = (100+q)/100*x+ayp < 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;int maxx = 100 * (a + 1);for (int x = 1; x <= maxx; x++)if (f(p, x) < f(q, x, a)) cnt++;if (f(p, MAX_X) < f(q, MAX_X + a))cnt += MAX_X - maxx;printf("%d\n", cnt);return 0;}