-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJ03040.java
More file actions
51 lines (47 loc) · 1.7 KB
/
J03040.java
File metadata and controls
51 lines (47 loc) · 1.7 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
40
41
42
43
44
45
46
47
48
49
50
51
package CODE_PTIT;
import java.util.*;
public class J03040 {
public static int Check1(String s){
if((s.charAt(5) - '0') < (s.charAt(6) - '0') &&
(s.charAt(6) - '0') < (s.charAt(7) - '0') &&
(s.charAt(7) - '0') < (s.charAt(9) - '0') &&
(s.charAt(9) - '0') < (s.charAt(10) - '0')) return 1;
return 0;
}
// public static int Check2(String s){
// if((s.charAt(5) - '0') == (s.charAt(6) - '0') &&
// (s.charAt(6) - '0') == (s.charAt(7) - '0') &&
// (s.charAt(7) - '0') == (s.charAt(9) - '0') &&
// (s.charAt(9) - '0') == (s.charAt(10) - '0')) return 1;
// return 0;
// }
public static int Check3(String s){
if(s.charAt(5) == s.charAt(6) &&
s.charAt(6) == s.charAt(7) &&
s.charAt(9) == s.charAt(10)) return 1;
return 0;
}
public static int Check4(String s){
if(s.charAt(5) != '6' && s.charAt(5)!= '8' ||
s.charAt(6) != '6' && s.charAt(6) != '8' ||
s.charAt(7) != '6' && s.charAt(7)!= '8' ||
s.charAt(9) != '6' && s.charAt(9)!= '8' ||
s.charAt(10) != '6' && s.charAt(10)!= '8') return 0;
return 1;
}
public static void main(String[] args) {
Scanner inp = new Scanner(System.in);
int t;
t = Integer.parseInt(inp.nextLine());
while(t-- > 0){
String s = inp.nextLine();
if(Check1(s) == 1 || Check3(s) == 1
|| Check4(s) == 1){
System.out.println("YES");
}
else{
System.out.println("NO");
}
}
}
}