//关于java的BufferReader输入的使用模板,可以自己添加到ide的模板库里面使用,就是没有Scanner的hasNext()方//法,有大佬可以帮忙写个封装么,这样就能写杭电别的关于hasNext的oj题了
//借鉴地址
//https://www.cpe.ku.ac.th/~jim/java-io.html
//输出
static PrintWriter out;
//输入类
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
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());}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
完整的模板
import java.math.*;
import java.util.*;
import java.lang.*;
import java.io.*;
import java.awt.*;
public class Main {
static final int N = 100010;
static int q[] = new int[N];
//把解决方案放这里
public static void solveCom() {
FastReader sc = new FastReader();
int n = sc.nextInt();
} // solve fn ends
public static void solveSub() {
FastReader sc = new FastReader();
int t = sc.nextInt();
while (t-- > 0) {
}
} // solve fn ends
public static void solveTrue() {
FastReader sc = new FastReader();
while (true) {
}
} // solve fn ends
public static void solveScan() {
Scanner sc = new Scanner(new BufferedInputStream(System.in));
while (sc.hasNext()) {
}
}
public static void main(String[] args) throws Exception {
//调用solve方法,好处是有多个题解可以写n个solve方法
solveCom();
// solveSub();
// solveTrue();
// solveScan();
}
//输出
static PrintWriter out;
//输入类
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
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());}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
}