結果

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

ソースコード

diff #

#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(ll (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(P<=Q){
		cout<<1'000'000'000<<endl;
		return 0;
	}
	res=0;
	constexpr ll lim = 3e8;
	REP(x,1,lim){
		if(judge(P,Q,A,x))res++;
	}
	cout<<res<<endl;
	return 0;
}
0