forked from deepanshumishra/JavaAndCPP_programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCOLOUR.java
More file actions
48 lines (42 loc) · 939 Bytes
/
Copy pathCOLOUR.java
File metadata and controls
48 lines (42 loc) · 939 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package codechef_lib;
import java.util.Arrays;
import java.util.Scanner;
public class COLOUR {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int cases=sc.nextInt();
while(cases--!=0) {
int arr[] = new int[3];
int x = sc.nextInt();
int y = sc.nextInt();
int z = sc.nextInt();
arr[0]=x;arr[1]=y;arr[2]=z;
Arrays.sort(arr);
int s=0;
if(arr[0]>0){
arr[0]--;
s++;
}
if(arr[1]>0){
arr[1]--;
s++;
}
if(arr[2]>0){
arr[2]--;
s++;
}
if(arr[2]>0 && arr[1]>0){
arr[2]--; arr[1]--; s++;
}
if(arr[2]>0 && arr[0]>0){
arr[2]--; arr[0]--; s++;
}
if(arr[1]>0 && arr[0]>0){
arr[1]--; arr[0]--; s++;
}
System.out.println(s);
}
}
}
//AC