結果

問題 No.928 軽減税率?
ユーザー Bwambocos
提出日時 2019-11-22 22:20:11
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 652 bytes
コンパイル時間 2,103 ms
コンパイル使用メモリ 192,676 KB
最終ジャッジ日時 2025-01-08 05:11:40
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 14 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

long double P, Q, A;

bool check(LL x)
{
	LL res1 = (1 + P / 100) * x;
	LL res2 = (1 + Q / 100) * x + A;
	return res1 < res2;
}

int main()
{
	in >> P >> Q >> A;

	LL left = 0, right = 1000000000;
	while (right - left > 1)
	{
		auto mid = (left + right) / 2;
		if (check(mid)) left = mid;
		else right = mid;
	}

	LL ans = left;
	for (LL x = left; x >= left - 100000; --x)
	{
		if (x <= 0) break;
		LL res1 = (1 + P / 100) * x;
		LL res2 = (1 + Q / 100) * x + A;
		if (res1 >= res2) --ans;
	}
	out << ans << std::endl;
}
0