2072A - A. New World, New Me, New Array.

 
public class App {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int cases = Integer.parseInt(sc.nextLine());
        for (int i = 0; i < cases; ++i) {
            int n = sc.nextInt();
            int k = sc.nextInt();
            int p = sc.nextInt();
            k = Math.abs(k);
            p = Math.abs(p);
            if (k > p * n) {
                System.out.println(-1);
                continue;
            }
            System.out.println(k / p + ((k % p > 0) ? 1 : 0));
            sc.nextLine();
        }
        sc.close();
    }
}
posted @ 2025-03-26 15:25  kayaker  阅读(12)  评论(0)    收藏  举报