forked from allicen/Java-1000
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChessField.java
More file actions
25 lines (23 loc) · 965 Bytes
/
ChessField.java
File metadata and controls
25 lines (23 loc) · 965 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
package chess_field;
import java.util.*;
import java.io.*;
public class ChessField {
private static ArrayList<Integer> coordinate = new ArrayList<>();
private static void getData() throws IOException{
FileReader file = new FileReader("input.txt");
Scanner sc = new Scanner(file);
String str = sc.nextLine();
StringTokenizer st = new StringTokenizer(str, " ");
while (st.hasMoreTokens()){
coordinate.add(Integer.valueOf(st.nextToken()) % 2);
}
}
public static void main(String[] argv) throws IOException{
getData();
String result = (coordinate.get(0).equals(coordinate.get(1)) && coordinate.get(2).equals(coordinate.get(3)) ||
!coordinate.get(0).equals(coordinate.get(1)) && !coordinate.get(2).equals(coordinate.get(3))) ? "YES" : "NO";
PrintWriter pw = new PrintWriter(new File("output.txt"));
pw.print(result);
pw.close();
}
}