結果

問題 No.338 アンケート機能
ユーザー はむ吉🐹
提出日時 2016-03-13 23:21:06
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 679 bytes
コンパイル時間 642 ms
コンパイル使用メモリ 64,992 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-08 03:05:16
合計ジャッジ時間 1,905 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <limits>


int compute_min_sum(int a0, int b0, int max_cand = 500) {
	auto answer = std::numeric_limits<int>::max();
	for (auto a = 0; a < max_cand; a++)
	{
		for (auto b = 0; b < max_cand; b++)
		{
			if (a == 0 && b == 0) {
				continue;
			}
			auto s = a + b;
			auto cond_a = a0 == std::round(100 * (double)a / s);
			auto cond_b = b0 == std::round(100 * (double)b / s);
			if (cond_a && cond_b) {
				answer = std::min(answer, s);
			}
		}
	}
	return answer;
}


int main() {
	int a0, b0;
	std::cin >> a0 >> b0;
	std::cout << compute_min_sum(a0, b0) << std::endl;
	return EXIT_SUCCESS;
}
0