-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMinimumCarsRequired.java
More file actions
56 lines (40 loc) · 1.03 KB
/
MinimumCarsRequired.java
File metadata and controls
56 lines (40 loc) · 1.03 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
/*
Minimum Cars required
A single car can accommodate at most 4 people.
N friends want to go to a restaurant for a party. Find the minimum number of cars required to accommodate all the friends.
Input Format
The first line contains a single integer T - the number of test cases. Then the test cases follow.
The first and only line of each test case contains an integer N - denoting the number of friends.
Output Format
For each test case, output the minimum number of cars required to accommodate all the friends.
Constraints
1 ≤ T ≤ 1000
2 ≤ N ≤ 1000
Sample Input
4
4
2
7
98
Sample Output
1
1
2
25
*/
import java.util.Scanner;
public class MinimumCarsRequired {
public static void main(String[] args) {
// your code goes here
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
int x = sc.nextInt();
int k = x / 4;
if (x % 4 != 0) {
k += 1;
}
System.out.println(k);
}
}
}