import java.util.*; import java.io.*; import java.util.regex.*; public class ballot{ static String[] parties; static float[] votes; public static void main(String[] args) throws Exception{ BufferedReader in = new BufferedReader(new FileReader(new File("ballot.in"))); Pattern pa = Pattern.compile("(\\d+) (\\d+)\\s*"); Matcher m = pa.matcher(in.readLine()); m.matches(); int p = Integer.parseInt(m.group(1)); int g = Integer.parseInt(m.group(2)); parties = new String[p]; votes = new float[p]; String input; Pattern p1 = Pattern.compile("(\\w+) (\\d+.\\d)\\s*"); for (int i=0; i") && !input.startsWith("=")){ index = input.indexOf(' '); value += votes[getNumberOfParty(input.substring(0,index))]; input = input.substring(index+1); if (input.startsWith("+")) input = input.substring(2); } System.out.print("Guess #" + i + " was "); if (input.startsWith("<=")){ guess = Integer.parseInt(input.substring(3)); op = "<="; } else if (input.startsWith("<")){ guess = Integer.parseInt(input.substring(2)); op = "<"; } else if (input.startsWith(">=")){ guess = Integer.parseInt(input.substring(3)); op = ">="; } else if (input.startsWith(">")){ guess = Integer.parseInt(input.substring(2)); op = ">"; } else { guess = Integer.parseInt(input.substring(2)); op = "="; } if (op.equals("<=")) if (value <= guess) System.out.print("correct.\n"); else System.out.print("incorrect.\n"); else if (op.equals("<")) if (value < guess) System.out.print("correct.\n"); else System.out.print("incorrect.\n"); else if (op.equals(">=")) if (value >= guess) System.out.print("correct.\n"); else System.out.print("incorrect.\n"); else if (op.equals(">")) if (value > guess) System.out.print("correct.\n"); else System.out.print("incorrect.\n"); else if (op.equals("=")) if (value == guess) System.out.print("correct.\n"); else System.out.print("incorrect.\n"); } } static int getNumberOfParty(String party){ for (int i=0; i