-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheaterius's Problem
More file actions
34 lines (26 loc) · 1017 Bytes
/
Cheaterius's Problem
File metadata and controls
34 lines (26 loc) · 1017 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
26
27
28
29
30
31
32
33
34
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine().trim());
HashSet<String> set = new HashSet<>();
for (int i = 0; i < n; i++) {
String r1 = br.readLine().trim();
String r2 = br.readLine().trim();
int a = r1.charAt(0) - '0';
int b = r1.charAt(1) - '0';
int c = r2.charAt(0) - '0';
int d = r2.charAt(1) - '0';
String[] rot = new String[4];
rot[0] = "" + a + b + c + d; // 0°
rot[1] = "" + c + a + d + b; // 90°
rot[2] = "" + d + c + b + a; // 180°
rot[3] = "" + b + d + a + c; // 270°
Arrays.sort(rot);
set.add(rot[0]);
if (i < n - 1) br.readLine(); // consume "**"
}
System.out.println(set.size());
}
}