-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDesen artistic.java
More file actions
39 lines (39 loc) · 1.39 KB
/
Desen artistic.java
File metadata and controls
39 lines (39 loc) · 1.39 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
import java.util.*;
public class Eccpr{
public static void main(String [] args){
Scanner sc = new Scanner(System.in);
ArrayList<String>s = new ArrayList<>();
int n = sc.nextInt();
for(int i=0;i<n;i++){
s.add(sc.next());
}
for(int i=0;i<s.size();i++){
for(int j=0;j<s.size();j++){
if(s.get(i).equals("red")&&s.get(j).equals("blue"))s.add("purple");
if(s.get(i).equals("red")&&s.get(j).equals("yellow"))s.add("orange");
if(s.get(i).equals("yellow")&&s.get(j).equals("blue"))s.add("green");
if(s.get(i).equals("orange")&&s.get(j).equals("blue"))s.add("brown");
}
}
boolean verif=false;
while(sc.hasNext()){
String nume = sc.next();
n = sc.nextInt();
ArrayList<String>list = new ArrayList<>();
for(int i=0;i<n;i++){
list.add(sc.next());
}
for(int i=0;i<list.size();i++){
verif=false;
for(int j=0;j<s.size();j++){
if(list.get(i).equals(s.get(j))){
verif=true;
break;
}
}
if(verif==false)break;
}
if(verif==true)System.out.println(nume);
}
}
}