qwerty787788

IDEA Template

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