結果

問題 No.231 めぐるはめぐる (1)
ユーザー yuki2006yuki2006
提出日時 2015-06-26 03:01:44
言語 Java21
(openjdk 21)
結果
MLE  
実行時間 -
コード長 1,271 bytes
コンパイル時間 4,607 ms
コンパイル使用メモリ 79,656 KB
実行使用メモリ 130,084 KB
最終ジャッジ日時 2023-09-22 00:45:35
合計ジャッジ時間 9,149 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Random;
import java.util.Scanner;

public class Yukicoder231 {

    public static final int EXP = 3000000;


    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] gain = new int[N];
        int maxIndex = 0;
        int max = 0;
        for (int i = 0; i < N; i++) {
            int G = scanner.nextInt();
            int D = scanner.nextInt();
            gain[i] = G - EXP / 100 * D;
            if (max < gain[i]) {
                max = gain[i];
                maxIndex = i;
            }
        }
        if (EXP > gain[maxIndex] * 6) {
            System.out.println("NO");
        } else {
            System.out.println("YES");
            int[] choice = new int[6];
            while (true) {
                int sum = 0;
                Random random = new Random();
                for (int i = 0; i < 6; i++) {
                    choice[i] = random.nextInt(gain.length);
                    sum += gain[choice[i]];
                }
                if (sum >= EXP) {
                    break;
                }
            }
            for (int i = 0; i < 6; i++) {
                System.out.println(choice[i]);
            }
        }


    }
}
0