Adding some more judges, here and there.
[and.git] / NEERC / headshot / headshot_ia.java
blob469b4cc8d9282cba4f593796a9ca8df70ee70e67
1 import java.io.*;
2 import java.util.ArrayList;
4 /**
5 * @author Iskander Akishev
6 */
7 public class headshot_ia implements Runnable {
9 private static final String FILE_NAME = "headshot";
11 public void run() {
12 try {
13 solve();
14 } catch (Throwable t) {
15 t.printStackTrace();
16 System.exit(1);
20 private BufferedReader in;
21 private PrintWriter out;
23 private void solve() throws Exception {
24 in = new BufferedReader(new FileReader(FILE_NAME + ".in"));
25 out = new PrintWriter(new File(FILE_NAME + ".out"));
27 ArrayList<Boolean> b = new ArrayList<Boolean>();
28 int m = 0;
29 for (char c : in.readLine().trim().toCharArray()) {
30 b.add(c == '1');
31 if (c == '1') {
32 m++;
35 int n = b.size();
37 b.add(b.get(0));
38 int k = 0;
39 int l = 0;
40 for (int i = 0; i < n; i++) {
41 if (!b.get(i)) {
42 k++;
43 if (b.get(i + 1)) {
44 l++;
49 int compare = m * k - l * n;
50 if (compare > 0) {
51 out.println("SHOOT");
52 } else if (compare < 0) {
53 out.println("ROTATE");
54 } else {
55 out.println("EQUAL");
58 in.close();
59 out.close();
62 public static void main(String[] args) {
63 new Thread(new headshot_ia()).start();