qwerty787788

FBHC Template

Mar 3rd, 2015
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.89 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.*;
  3.  
  4. public class ${primary_type_name} {
  5.     FastScanner in;
  6.     PrintWriter out;
  7.  
  8.     void solve() {
  9.         int tc = in.nextInt();
  10.         for (int t = 0; t < tc; t++) {
  11.             out.print("Case #" + (t + 1) + ": ");
  12.             ${cursor}
  13.             System.err.println((t + 1) + "/" + tc + " done");
  14.         }
  15.     }
  16.  
  17.     void run() {
  18.         try {
  19.             in = new FastScanner(new File("${primary_type_name}.in"));
  20.             out = new PrintWriter(new File("${primary_type_name}.out"));
  21.  
  22.             solve();
  23.  
  24.             out.close();
  25.         } catch (FileNotFoundException e) {
  26.             e.printStackTrace();
  27.         }
  28.     }
  29.  
  30.     void runIO() {
  31.         in = new FastScanner(System.in);
  32.         out = new PrintWriter(System.out);
  33.  
  34.         solve();
  35.  
  36.         out.close();
  37.     }
  38.  
  39.     class FastScanner {
  40.         BufferedReader br;
  41.         StringTokenizer st;
  42.  
  43.         public FastScanner(File f) {
  44.             try {
  45.                 br = new BufferedReader(new FileReader(f));
  46.             } catch (FileNotFoundException e) {
  47.                 e.printStackTrace();
  48.             }
  49.         }
  50.  
  51.         public FastScanner(InputStream f) {
  52.             br = new BufferedReader(new InputStreamReader(f));
  53.         }
  54.  
  55.         String next() {
  56.             while (st == null || !st.hasMoreTokens()) {
  57.                 String s = null;
  58.                 try {
  59.                     s = br.readLine();
  60.                 } catch (IOException e) {
  61.                     e.printStackTrace();
  62.                 }
  63.                 if (s == null)
  64.                     return null;
  65.                 st = new StringTokenizer(s);
  66.             }
  67.             return st.nextToken();
  68.         }
  69.  
  70.         boolean hasMoreTokens() {
  71.             while (st == null || !st.hasMoreTokens()) {
  72.                 String s = null;
  73.                 try {
  74.                     s = br.readLine();
  75.                 } catch (IOException e) {
  76.                     e.printStackTrace();
  77.                 }
  78.                 if (s == null)
  79.                     return false;
  80.                 st = new StringTokenizer(s);
  81.             }
  82.             return true;
  83.         }
  84.  
  85.         int nextInt() {
  86.             return Integer.parseInt(next());
  87.         }
  88.  
  89.         long nextLong() {
  90.             return Long.parseLong(next());
  91.         }
  92.  
  93.         double nextDouble() {
  94.             return Double.parseDouble(next());
  95.         }
  96.     }
  97.  
  98.     public static void main(String[] args) {
  99.         new ${primary_type_name}().run();
  100.     }
  101. }
Advertisement
Add Comment
Please, Sign In to add comment