目录
前言
算法题的输入输出模板
一、测试运行
二、代码
package cource;
import java.io.*;
import java.util.StringTokenizer;
/*
out.println后要flush
in.next到空格或者换行结束
in.nextInt()后,不需要in.next()消除换行符
*/
public class IOTemplate {
static InputReader sc = new InputReader(System.in);
static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
public static void main(String[] args) {
}
public static class InputReader {
BufferedReader reader;
StringTokenizer tokenizer;
public InputReader(InputStream in) {
reader = new BufferedReader(new InputStreamReader(in));
}
public String next() throws IOException {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
tokenizer = new StringTokenizer(reader.readLine());
}
return tokenizer.nextToken();
}
public int nextInt() throws IOException {
return Integer.parseInt(next());
}
}
}