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();
}
}

浙公网安备 33010602011771号