ACM模式下,Java输入输出流模板(进一步封装了不好用的BufferedReader,并提高了输出的性能)
好用的Java输入输出流模板
import java.util.*;
import java.io.*;
public class Main{
static StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
static PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
static int nextInt() throws IOException {
st.nextToken();
return (int)st.nval;
}
static double nextDouble() throws IOException {
st.nextToken();
return st.nval;
}
static String nextString() throws IOException {
st.nextToken();
return st.sval;
}
public static void main(String[] args) throws IOException {
#输出,就跟使用System.out.print()感觉一模一样
#pw.print("你想输出的内容");
#pw.flush();
#最后别忘了flush,pw会先将要输出的内容保存到内存缓冲区中,最后只通过一次IO输出
}
}