結果

問題 No.928 軽減税率?
ユーザー season1618
提出日時 2019-11-22 22:02:25
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 760 bytes
コンパイル時間 1,495 ms
コンパイル使用メモリ 166,840 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-11 03:39:55
合計ジャッジ時間 2,558 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=1e5;
const long inf=1e9;
int gauss(double x,int y){
	return x*y;
}
int main(){
	double p,q,s; cin>>p>>q>>s;
	p=1+p/100; q=1+q/100;
	int a=0,b=inf+1;
	while(b-a>1){
		if(gauss(p,(a+b)/2)<gauss(q,(a+b)/2)+s) a=(a+b)/2;
		else b=(a+b)/2;
	}int cnt=0;
    if(a<100){
        rep(i,1,200){
            if(gauss(p,i)<gauss(q,i)+s) cnt++;
        }cout<<cnt<<endl;
    }else{
        rep(i,a-99,a+100){
            if(gauss(p,i)<gauss(q,i)+s) cnt++;
        }cout<<a-100+cnt<<endl;
    }
}
0