We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f5b01c6 commit 42673feCopy full SHA for 42673fe
1359/A/Main.java
@@ -0,0 +1,25 @@
1
+import java.util.Scanner;
2
+
3
+public class Main {
4
+ public static void main(String[] args) {
5
+ Scanner sc = new Scanner(System.in);
6
7
+ int t = sc.nextInt();
8
+ for (int tc = 0; tc < t; ++tc) {
9
+ int n = sc.nextInt();
10
+ int m = sc.nextInt();
11
+ int k = sc.nextInt();
12
13
+ System.out.println(solve(n, m, k));
14
+ }
15
16
+ sc.close();
17
18
19
+ static int solve(int n, int m, int k) {
20
+ int first = Math.min(m, n / k);
21
+ int second = (m - first + k - 2) / (k - 1);
22
23
+ return first - second;
24
25
+}
0 commit comments