結果

問題 No.928 軽減税率?
ユーザー CELICA
提出日時 2020-09-16 20:12:30
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 1,000 ms
コード長 641 bytes
コンパイル時間 1,678 ms
コンパイル使用メモリ 166,720 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-22 03:30:43
合計ジャッジ時間 2,692 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ul = unsigned long;
using ull = unsigned long long;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	ll p, q, a, res{ 0 };
	cin >> p >> q >> a;

	if (p == q)
		res = a == 0 ? 0 : 1000000000;
	else if (p < q)
	{
		res = 1000000000;

		for (ll i = 1; i <= 100 * (a + q - p + 1) / (q - p); ++i)
		{
			if ((100 + p) * i / 100 >= (100 + q) * i / 100 + a)
				--res;
		}
	}
	else
	{
		for (ll i = 1; i<= 100 * (a + p - q + 1) / (p - q); ++i)
		{
			if ((100 + p) * i / 100 < (100 + q) * i / 100 + a)
				++res;
		}
	}

	cout << res << "\n";

	return 0;
}
0