-
Notifications
You must be signed in to change notification settings - Fork 0
/
cf_round894_div3_A.java
45 lines (44 loc) · 1.37 KB
/
cf_round894_div3_A.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
import java.util.*;
public class cf_round894_div3_A {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t --> 0){
StringBuilder sb = new StringBuilder();
int m = sc.nextInt();
int n = sc.nextInt();
char[][] matrix = new char[m][n];
for(int i = 0;i<m;i++){
for(int j = 0;j<n;j++){
matrix[i][j] = sc.next().charAt(0);
}
}
for(int j = 0;j<n;j++){
for(int i = 0;i<m;i++){
if(matrix[j][i] == 'v'){
sb.append("v");
break;
}
else if(matrix[j][i] == 'i'){
sb.append("i");
break;
}
else if(matrix[j][i] == 'k'){
sb.append("k");
break;
}
else if(matrix[j][i] == 'a'){
sb.append("a");
break;
}
}
}
if(sb.toString().equals("vika")){
System.out.println("yes");
}
else{
System.out.println("no");
}
}
}
}