-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathp390.java
47 lines (43 loc) · 1.54 KB
/
p390.java
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
package com.caiomed03.aceptaelreto;
import java.util.Scanner;
public class p390 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int casosPrueba = sc.nextInt();
for (int i = 0; i < casosPrueba; i++) {
int magentaDisp = sc.nextInt();
int amarilloDisp = sc.nextInt();
int cianDisp = sc.nextInt();
String colores = sc.next();
for (int j = 0; j < colores.length(); j++) {
if (colores.charAt(j) == 'M') {
magentaDisp--;
} else if (colores.charAt(j) == 'A') {
amarilloDisp--;
} else if (colores.charAt(j) == 'C') {
cianDisp--;
} else if (colores.charAt(j) == 'R') {
magentaDisp--;
amarilloDisp--;
} else if (colores.charAt(j) == 'N') {
magentaDisp--;
amarilloDisp--;
cianDisp--;
} else if (colores.charAt(j)=='V') {
amarilloDisp--;
cianDisp--;
}
else if(colores.charAt(j)=='L'){
magentaDisp--;
cianDisp--;
}
}
if(magentaDisp<0 || amarilloDisp <0 || cianDisp<0){
System.out.println("NO");
}
else{
System.out.println("SI "+magentaDisp+" "+amarilloDisp+" "+cianDisp);
}
}
}
}