```java
import java.math.*; import java.util.*; import java.io.*; public class Main { /** 输出流, 输出完之后记得用 out.flush() 清空一下缓存区 */ static PrintWriter out = new PrintWriter(System.out); /** FastReader类 */ static FastReader sc = new FastReader(); /// 静态变量/// // static final int N = (int) 1e5 + 10, INF = 0x3f3f3f3f; // static int arr[] = new int[N]; // static int q[] = new int[N]; // static char g[][] = new char[N][]; // static boolean st[][] = new boolean[N][N]; static int n, m, t; static int res, ans; /// 静态方法/// /// static void solve() { while (sc.hasNext()) { $END$ out.flush(); } out.flush(); } /// /// //写解决方法/ static void solveCom() { // 不需要 hasNext() int n = sc.nextInt(); out.flush(); } static void solveSub() { // t 次 t = sc.nextInt(); while (t-- > 0) { out.flush(); } out.flush(); } static void solveScan() { // 需要 hasNext() solve(); out.flush(); } /// /// public static void main(String[] args) throws Exception { /* 调用solve方法,好处是有多个题解可以写n个solve方法 */ // solveCom(); // solveSub(); solveScan(); // 最后清空并关闭输出流 out.flush(); out.close(); } //封装快速读取类的方法(基于Scanner的方法来写)/ static class FastReader { // 输入类 BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; public FastReader() { } String next () { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); }
boolean hasNext() { while (st == null || !st.hasMoreTokens()) { try { String line = br.readLine(); if (line == null) return false; st = new StringTokenizer(line); } catch (IOException e) { throw new RuntimeException(e); } } return true; } int nextInt () { return Integer.parseInt(next()); } long nextLong () { return Long.parseLong(next()); } double nextDouble () { return Double.parseDouble(next()); } String nextLine () { String line = null; try { line = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return line; } } /// }
```