-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDiceRolling.java
More file actions
27 lines (24 loc) · 827 Bytes
/
Copy pathDiceRolling.java
File metadata and controls
27 lines (24 loc) · 827 Bytes
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
/**
* Created by MalhotR1 on 12/17/2018.
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class DiceRolling {
public static void main(String[] args) throws IOException {
try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
int T = Integer.parseInt(br.readLine().trim());
for (int t = 0; t < T; t++) {
int N = Integer.parseInt(br.readLine().trim());
if (N > 3 && N < 8) System.out.println(1);
else if (N % 2 == 0) System.out.println(N / 2);
else {
N -= 3;
int total = N / 2 + 1;
System.out.println(total);
}
}
}
}
}