結果

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

ソースコード

diff #

#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll=long long;
using ld=ll;

bool judge(ld P,ld Q,ll A, ll x){
	ll in = (100+P)*x/100;
	ll out = (100+Q)*x/100+A;
	//cout<<x<<":"<<in<<"-"<<out<<endl;
	return in<out;
}

ll rjudge(ld P, ld Q, ll A){
	ll safe=0,out=1'000'000'001;
	while(out-safe>1){
		ll mid=(safe+out)/2;
		(judge(P,Q,A,mid)?safe:out)=mid;
	}
	return safe;	
}

int main()
{
	ld P,Q;
	ll A;
	cin>>P>>Q>>A;

	ll res = rjudge(P,Q,A);
	if(res>1e8){
		cout<<res<<endl;
	}else{
		res=0;
		REP(x,1,3e8){
			if(judge(P,Q,A,x))res++;
		}
		cout<<res<<endl;
	}
	return 0;
}
0