niyaznigmatullin

Untitled

Apr 21st, 2014
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.46 KB | None | 0 0
  1. import java.util.*;
  2. import java.io.*;
  3.  
  4. public class Template {
  5.     FastScanner in;
  6.     PrintWriter out;
  7.  
  8.     public void solve() throws IOException {
  9.        
  10.     }
  11.  
  12.     public void run() {
  13.         try {
  14.             in = new FastScanner(new File(".in"));
  15.             out = new PrintWriter(new File(".out"));
  16.  
  17.             solve();
  18.  
  19.             out.close();
  20.         } catch (IOException e) {
  21.             e.printStackTrace();
  22.         }
  23.     }
  24.  
  25.     class FastScanner {
  26.         BufferedReader br;
  27.         StringTokenizer st;
  28.  
  29.         FastScanner(File f) {
  30.             try {
  31.                 br = new BufferedReader(new FileReader(f));
  32.             } catch (FileNotFoundException e) {
  33.                 e.printStackTrace();
  34.             }
  35.         }
  36.  
  37.         boolean hasNext() {
  38.             while (st == null || !st.hasMoreTokens()) {
  39.                 try {
  40.                     String line = br.readLine();
  41.                     if (line == null)
  42.                         return false;
  43.                     st = new StringTokenizer(line);
  44.                 } catch (IOException e) {
  45.                     e.printStackTrace();
  46.                 }
  47.             }
  48.             return true;
  49.         }
  50.  
  51.         String next() {
  52.             return hasNext() ? st.nextToken() : null;
  53.         }
  54.  
  55.         int nextInt() {
  56.             return Integer.parseInt(next());
  57.         }
  58.     }
  59.  
  60.     public static void main(String[] arg) {
  61.         new Template().run();
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment