結果

問題 No.338 アンケート機能
ユーザー 37zigen37zigen
提出日時 2016-04-11 20:37:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 905 bytes
コンパイル時間 1,848 ms
コンパイル使用メモリ 74,480 KB
実行使用メモリ 54,252 KB
最終ジャッジ日時 2024-04-25 15:58:57
合計ジャッジ時間 6,213 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
54,212 KB
testcase_01 AC 116 ms
53,988 KB
testcase_02 AC 107 ms
53,152 KB
testcase_03 AC 117 ms
53,928 KB
testcase_04 AC 115 ms
53,844 KB
testcase_05 AC 112 ms
53,476 KB
testcase_06 AC 111 ms
53,180 KB
testcase_07 AC 98 ms
52,816 KB
testcase_08 AC 112 ms
54,036 KB
testcase_09 AC 116 ms
53,880 KB
testcase_10 AC 116 ms
54,196 KB
testcase_11 AC 117 ms
54,248 KB
testcase_12 AC 116 ms
54,252 KB
testcase_13 AC 118 ms
53,952 KB
testcase_14 AC 103 ms
52,976 KB
testcase_15 AC 106 ms
52,772 KB
testcase_16 AC 104 ms
53,056 KB
testcase_17 AC 103 ms
52,976 KB
testcase_18 AC 104 ms
53,104 KB
testcase_19 AC 121 ms
53,968 KB
testcase_20 AC 110 ms
53,032 KB
testcase_21 AC 118 ms
54,120 KB
testcase_22 AC 112 ms
53,024 KB
testcase_23 AC 118 ms
53,908 KB
testcase_24 AC 104 ms
52,940 KB
testcase_25 AC 108 ms
53,380 KB
testcase_26 AC 118 ms
53,984 KB
testcase_27 AC 108 ms
53,300 KB
testcase_28 AC 107 ms
53,088 KB
testcase_29 AC 118 ms
53,868 KB
testcase_30 AC 117 ms
53,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;
import java.util.*;
public class Main{
	public static void main(String[] args)throws Exception{
		new Main().solve();
	}
	void solve(){
		Scanner sc=new Scanner(System.in);
		int A=sc.nextInt();
		int B=sc.nextInt();
		
		//A=100a/(a+b)(小数点は四捨五入)
		//B=100b/(a+b)
		//a+bを最小化
		//Yesと答えた人がAパーセント
		//Noと答えた人がBパーセント
		//
		//A+B=100のとき
		//a=A,b=Bとすると、
		//成り立つので上界は100
		//A+B=101のとき
		//四捨五入前は
		//AはA-0.5、BはB-0.5となっている。
		//このとき、a=2A-1,b=2B-1とすると、
		//なりたつ
		//よって、上界は200
		//
		
		for(int i=1;i<=200;i++){
			for(int j=0;j<=i;j++){
				double a=j;
				double b=i-j;
				if(A==(int)(100*a/(a+b)+0.5)&&B==(int)(100*b/(a+b)+0.5)){
					System.out.println((int)(a+b));
					return;
				}
			}
		}
		
	}
}
0