結果

問題 No.338 アンケート機能
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-12-09 21:10:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 205 ms / 2,000 ms
コード長 1,236 bytes
コンパイル時間 2,942 ms
コンパイル使用メモリ 74,056 KB
実行使用メモリ 59,124 KB
最終ジャッジ日時 2023-08-19 06:08:13
合計ジャッジ時間 9,793 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 204 ms
59,044 KB
testcase_01 AC 194 ms
58,704 KB
testcase_02 AC 197 ms
58,756 KB
testcase_03 AC 191 ms
58,400 KB
testcase_04 AC 107 ms
55,332 KB
testcase_05 AC 198 ms
58,396 KB
testcase_06 AC 107 ms
55,708 KB
testcase_07 AC 198 ms
59,068 KB
testcase_08 AC 186 ms
58,800 KB
testcase_09 AC 193 ms
58,780 KB
testcase_10 AC 196 ms
58,916 KB
testcase_11 AC 203 ms
58,476 KB
testcase_12 AC 196 ms
58,180 KB
testcase_13 AC 194 ms
58,760 KB
testcase_14 AC 201 ms
58,576 KB
testcase_15 AC 200 ms
59,124 KB
testcase_16 AC 203 ms
58,684 KB
testcase_17 AC 205 ms
58,576 KB
testcase_18 AC 205 ms
58,992 KB
testcase_19 AC 199 ms
58,424 KB
testcase_20 AC 204 ms
58,548 KB
testcase_21 AC 198 ms
59,020 KB
testcase_22 AC 203 ms
58,900 KB
testcase_23 AC 197 ms
58,792 KB
testcase_24 AC 202 ms
58,392 KB
testcase_25 AC 197 ms
58,824 KB
testcase_26 AC 187 ms
58,712 KB
testcase_27 AC 197 ms
58,796 KB
testcase_28 AC 185 ms
58,816 KB
testcase_29 AC 203 ms
59,040 KB
testcase_30 AC 203 ms
59,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int min = Integer.MAX_VALUE;
        if(A==0||B==0){
            min=1;
        }else{
            int up=201;
            for(int i=1; i<up; i++){
                for(int j=1; j<up; j++){
                    BigDecimal l = new BigDecimal(i);
                    BigDecimal m = new BigDecimal(j);
                    BigDecimal n = new BigDecimal("100");
                    BigDecimal sum = l.add(m);
                    l=l.multiply(n);
                    m=m.multiply(n);
                    BigDecimal o = l.divide(sum, 0, BigDecimal.ROUND_HALF_UP);
                    BigDecimal p = m.divide(sum, 0, BigDecimal.ROUND_HALF_UP);
                    String q=o.toPlainString();
                    String r=p.toPlainString();
                    int x = Integer.parseInt(q);
                    int y = Integer.parseInt(r);
                    if(x==A && y==B){
                        min=Math.min(min,i+j);
                    }
                }
            }
        }
        System.out.println(min);
    }
}
0