結果

問題 No.338 アンケート機能
ユーザー ぴろずぴろず
提出日時 2016-01-29 22:28:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 538 bytes
コンパイル時間 2,039 ms
コンパイル使用メモリ 74,120 KB
実行使用メモリ 54,596 KB
最終ジャッジ日時 2024-04-25 15:41:06
合計ジャッジ時間 6,808 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
54,052 KB
testcase_01 AC 130 ms
54,224 KB
testcase_02 AC 128 ms
54,316 KB
testcase_03 AC 127 ms
53,888 KB
testcase_04 AC 124 ms
53,952 KB
testcase_05 AC 127 ms
53,752 KB
testcase_06 AC 116 ms
53,156 KB
testcase_07 AC 132 ms
54,236 KB
testcase_08 AC 126 ms
54,188 KB
testcase_09 AC 132 ms
54,292 KB
testcase_10 AC 127 ms
54,104 KB
testcase_11 AC 128 ms
53,872 KB
testcase_12 AC 123 ms
53,972 KB
testcase_13 AC 129 ms
54,336 KB
testcase_14 AC 128 ms
54,316 KB
testcase_15 AC 115 ms
52,728 KB
testcase_16 AC 128 ms
54,596 KB
testcase_17 AC 117 ms
52,832 KB
testcase_18 AC 128 ms
54,036 KB
testcase_19 AC 127 ms
54,100 KB
testcase_20 AC 130 ms
54,064 KB
testcase_21 AC 126 ms
54,072 KB
testcase_22 AC 131 ms
54,208 KB
testcase_23 AC 130 ms
54,012 KB
testcase_24 AC 126 ms
53,872 KB
testcase_25 AC 127 ms
53,992 KB
testcase_26 AC 128 ms
54,088 KB
testcase_27 AC 127 ms
54,268 KB
testcase_28 AC 124 ms
54,272 KB
testcase_29 AC 125 ms
53,968 KB
testcase_30 AC 122 ms
54,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no339;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int p = sc.nextInt();
		int q = sc.nextInt();
		for(int sum=1;;sum++) {
			for(int a=0;a<=sum;a++) {
				int b = sum - a;
				int p2 = divRound(100 * a, a + b);
				int q2 = divRound(100 * b, a + b);
				if (p == p2 && q == q2) {
					System.out.println(sum);
					return;
				}
			}
		}
	}
	
	public static int divRound(int a,int b) {
		return a / b + (a % b >= (b + 1) / 2 ? 1 : 0);
	}

}
0