private static void setStream(String in, String out) { try { System.setIn(new BufferedInputStream(new FileInputStream(in))); System.setOut(new PrintStream(out)); } catch (Exception e) { e.printStackTrace(); } }
/** @param args */ public static void main(String[] args) throws Exception { File file = new File("input.txt"); if (file.exists()) { System.setIn(new BufferedInputStream(new FileInputStream("input.txt"))); } out = System.out; bw = new BufferedWriter(new PrintWriter(out)); // sc = new Scanner(System.in); br = new BufferedReader(new InputStreamReader(System.in)); C231 t = new C231(); t.solve(); bw.close(); }