-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoloring.java
More file actions
31 lines (27 loc) · 785 Bytes
/
coloring.java
File metadata and controls
31 lines (27 loc) · 785 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
28
29
30
31
import java.util.*;
class coloring {
public static int botsscore(Integer cells) {
Integer count = 0;
if (cells == 1 || cells == 2 || cells == 3) {
return 1;
}
while (cells != 0) {
if (cells >= 0) {
cells = cells - 4;
count = count + 1;
} else {
return count;
}
}
return count;
}
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
Integer testcase = sc.nextInt();
for (int i = 0; i < testcase; i++) {
Integer cells = sc.nextInt();
Integer score = botsscore(cells);
System.out.println(score);
}
}
}