Created
February 21, 2018 23:26
-
-
Save Strikeskids/125fdd8c9e1e818a7407ff8a983b1bff to your computer and use it in GitHub Desktop.
Template for writing ACM ICPC solutions in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.Closeable; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.io.PrintWriter; | |
import java.util.StringTokenizer; | |
public class Icpc { | |
public static void main(String... args) throws Exception { | |
FastScan sc = new FastScan(new BufferedReader(new InputStreamReader(System.in))); | |
PrintWriter pw = new PrintWriter(System.out); | |
sc.close(); | |
pw.close(); | |
System.exit(0); | |
} | |
static class FastScan implements Closeable { | |
private BufferedReader br; | |
private StringTokenizer tk; | |
public FastScan(BufferedReader br) { | |
this.br = br; | |
} | |
public int in() throws NumberFormatException, IOException { | |
return Integer.parseInt(next()); | |
} | |
public long ln() throws NumberFormatException, IOException { | |
return Long.parseLong(next()); | |
} | |
public double db() throws NumberFormatException, IOException { | |
return Double.parseDouble(next()); | |
} | |
@Override | |
public void close() throws IOException { | |
tk = null; | |
br.close(); | |
} | |
public String next() throws IOException { | |
while (tk == null || !tk.hasMoreTokens()) { | |
String line = br.readLine(); | |
if (line == null) | |
return null; | |
tk = new StringTokenizer(line); | |
} | |
return tk.nextToken(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment