結果

問題 No.338 アンケート機能
ユーザー ky-on2000
提出日時 2018-02-11 18:22:08
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 771 ms
コンパイル使用メモリ 67,748 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-17 09:59:43
合計ジャッジ時間 1,894 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdlib>
#include <math.h>
using namespace std;
int main(){
	int ar,br;
	cin>>ar>>br;
	double rar,rbr;
	int car,cbr;
	int ap,bp;
	int tmp,ans;
	ans=200;
	//aを設定
	for(double i=0;i<=100;i++){
		//bを設定
		for(double k=0;k<=100;k++){
			if(i!=0||k!=0){
				rar=(100*i)/(i+k);
				rbr=(100*k)/(i+k);
				car=round(rar);
				cbr=round(rbr);
				if(car==ar&&cbr==br){
					tmp=i+k;
					if(tmp<ans)ans=tmp;
				}
			}
		}
	}
	cout<<ans<<endl;
}
0