結果

問題 No.338 アンケート機能
ユーザー ぴろずぴろず
提出日時 2016-01-29 22:28:33
言語 Java19
(openjdk 21)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 538 bytes
コンパイル時間 3,357 ms
コンパイル使用メモリ 71,280 KB
実行使用メモリ 57,744 KB
最終ジャッジ日時 2023-08-07 21:21:57
合計ジャッジ時間 6,951 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,508 KB
testcase_01 AC 121 ms
55,740 KB
testcase_02 AC 121 ms
55,724 KB
testcase_03 AC 121 ms
56,328 KB
testcase_04 AC 119 ms
55,816 KB
testcase_05 AC 123 ms
55,880 KB
testcase_06 AC 120 ms
56,096 KB
testcase_07 AC 121 ms
55,980 KB
testcase_08 AC 120 ms
56,156 KB
testcase_09 AC 124 ms
55,464 KB
testcase_10 AC 121 ms
56,144 KB
testcase_11 AC 120 ms
55,696 KB
testcase_12 AC 120 ms
55,796 KB
testcase_13 AC 120 ms
55,856 KB
testcase_14 AC 119 ms
55,460 KB
testcase_15 AC 119 ms
55,984 KB
testcase_16 AC 121 ms
55,544 KB
testcase_17 AC 120 ms
56,488 KB
testcase_18 AC 121 ms
55,644 KB
testcase_19 AC 121 ms
55,708 KB
testcase_20 AC 124 ms
55,536 KB
testcase_21 AC 125 ms
55,840 KB
testcase_22 AC 124 ms
55,772 KB
testcase_23 AC 122 ms
55,720 KB
testcase_24 AC 122 ms
55,808 KB
testcase_25 AC 124 ms
56,184 KB
testcase_26 AC 123 ms
56,136 KB
testcase_27 AC 124 ms
57,744 KB
testcase_28 AC 120 ms
55,880 KB
testcase_29 AC 120 ms
55,836 KB
testcase_30 AC 120 ms
55,724 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