Skip to content

Instantly share code, notes, and snippets.

@arviman
Created December 6, 2014 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arviman/6a01b00ebdf205d274de to your computer and use it in GitHub Desktop.
Save arviman/6a01b00ebdf205d274de to your computer and use it in GitHub Desktop.
package myPackage;
import myPackage.FastReader
{
BufferedReader br;
StringTokenizer tokenizer;
public FastReader(InputStream stream)
{
br = new BufferedReader(new InputStreamReader(stream));
tokenizer = null;
}
public FastReader(File f) {
try {
br = new BufferedReader(new FileReader(f));
tokenizer = null;
}
catch (FileNotFoundException e) {
e.printStackTrace();
}
}
private String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens())
try {
tokenizer = new StringTokenizer(br.readLine());
}
catch (IOException e) {
throw new RuntimeException(e);
}
return tokenizer.nextToken();
}
public String nextLine() {
try {
return br.readLine();
}
catch(Exception e) {
throw(new RuntimeException());
}
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
BigInteger nextBigInteger() {
return new BigInteger(next());
}
BigDecimal nextBigDecimal() {
return new BigDecimal(next());
}
};
import java.io.PrintWriter;
public class D {
public void solve(int testNumber, parseDouble(next());
}
BigInteger nextBigInteger() {
return new BigInteger(next());
}
BigDecimal nextBigDecimal() {
return new BigDecimal(next());
}
} in, PrintWriter out) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment