結果

問題 No.231 めぐるはめぐる (1)
ユーザー yuki2006
提出日時 2015-06-26 03:01:44
言語 Java
(openjdk 23)
結果
MLE  
実行時間 -
コード長 1,271 bytes
コンパイル時間 5,413 ms
コンパイル使用メモリ 78,016 KB
実行使用メモリ 129,584 KB
最終ジャッジ日時 2024-07-07 17:40:25
合計ジャッジ時間 8,597 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 2
other MLE * 1 -- * 10
権限があれば一括ダウンロードができます

ソースコード

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