結果

問題 No.338 アンケート機能
ユーザー tentententen
提出日時 2020-10-14 11:13:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 117 ms / 2,000 ms
コード長 1,002 bytes
コンパイル時間 2,364 ms
コンパイル使用メモリ 72,172 KB
実行使用メモリ 57,772 KB
最終ジャッジ日時 2023-09-28 00:31:45
合計ジャッジ時間 8,389 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
55,716 KB
testcase_01 AC 113 ms
55,704 KB
testcase_02 AC 111 ms
57,772 KB
testcase_03 AC 112 ms
56,024 KB
testcase_04 AC 112 ms
55,972 KB
testcase_05 AC 111 ms
55,692 KB
testcase_06 AC 109 ms
55,896 KB
testcase_07 AC 113 ms
56,080 KB
testcase_08 AC 117 ms
55,756 KB
testcase_09 AC 110 ms
55,560 KB
testcase_10 AC 111 ms
55,872 KB
testcase_11 AC 114 ms
55,708 KB
testcase_12 AC 112 ms
55,720 KB
testcase_13 AC 109 ms
55,912 KB
testcase_14 AC 106 ms
55,968 KB
testcase_15 AC 105 ms
56,060 KB
testcase_16 AC 106 ms
55,868 KB
testcase_17 AC 107 ms
56,004 KB
testcase_18 AC 111 ms
55,400 KB
testcase_19 AC 111 ms
55,632 KB
testcase_20 AC 114 ms
55,936 KB
testcase_21 AC 113 ms
56,040 KB
testcase_22 AC 111 ms
56,016 KB
testcase_23 AC 111 ms
55,412 KB
testcase_24 AC 110 ms
55,976 KB
testcase_25 AC 111 ms
55,656 KB
testcase_26 AC 107 ms
55,752 KB
testcase_27 AC 107 ms
55,636 KB
testcase_28 AC 115 ms
55,796 KB
testcase_29 AC 114 ms
55,720 KB
testcase_30 AC 109 ms
55,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int a = sc.nextInt();
    	int b = sc.nextInt();
    	if (a == 0 && b == 0) {
    	    System.out.println(0);
    	}
    	int ansA = Integer.MAX_VALUE;
    	int ansB = Integer.MAX_VALUE;
    	for (int i = 0; i <= 200; i++) {
    	    for (int j = 0; j <= 200; j++) {
    	        if (i == 0 && j == 0) {
    	            continue;
    	        }
    	        int tmpA = 1000 * i / (i + j);
    	        if (tmpA % 10 >= 5) {
    	            tmpA += 10;
    	        }
    	        tmpA /= 10;
     	        int tmpB = 1000 * j / (i + j);
    	        if (tmpB % 10 >= 5) {
    	            tmpB += 10;
    	        }
    	        tmpB /= 10;
    	        if (tmpA == a && tmpB == b) {
    	            ansA = Math.min(ansA, i);
    	            ansB = Math.min(ansB, j);
    	            break;
    	        }
    	    }
    	}
    	System.out.println(ansA + ansB);
	}
}
0