結果

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

ソースコード

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 = 1000000001;
	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 - 1000000; --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