-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFillCandies.java
More file actions
63 lines (46 loc) · 1.27 KB
/
FillCandies.java
File metadata and controls
63 lines (46 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
Fill Candies
Chef received N candies on his birthday. He wants to put these candies in some bags.
A bag has K pockets and each pocket can hold at most M candies.
Find the minimum number of bags Chef needs so that he can put every candy into a bag.
Input Format
The first line of input will contain a single integer T, denoting the number of test cases.
Each test case consists of a single line containing three space-separated integers N, K, M.
Output Format
For each test case, print the minimum number of bags Chef needs so that he can put all the candies in one of the bags.
Constraints
1 ≤ T ≤ 1000
1 ≤ N, K, M ≤ 100
Sample 1:
Input
4
6 2 3
3 1 2
8 4 1
25 4 2
Output
1
2
2
4
*/
import java.util.Scanner;
public class FillCandies {
public static void main(String[] args) throws java.lang.Exception {
// your code goes here
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
for (int i = 0; i < x; i++) {
int n = sc.nextInt();
int k = sc.nextInt();
int m = sc.nextInt();
int y = (k * m);
if (n % y == 0) {
System.out.println(n / y);
}
else {
System.out.println((n / y) + 1);
}
}
}
}