就ac了一个,大佬们帮我看看吧QAQ
查看原帖
就ac了一个,大佬们帮我看看吧QAQ
580992
Bloo楼主2021/11/13 10:30
import java.util.ArrayList;
import java.util.Scanner;

public class p2006赵神牛的游戏 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int m = sc.nextInt();
        int n = sc.nextInt();
        boolean flag = false;
        ArrayList<Integer> jh = new ArrayList<>();
        for (int i = 0; i < m; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            for (int j = 1; j*a <= k; j++) {
                if (j*b >= n){
                    flag = true;
                    jh.add(i+1);
                    break;
                }
            }
        }
        if (!flag)
            System.out.print(-1);
        else {
            System.out.print(jh.get(0));
            for (int i = 1; i < jh.size(); i++) {
                System.out.print(" "+jh.get(i));
            }
        }
    }
}

我实在想不出来哪里错了,球球大佬们了

2021/11/13 10:30
加载中...