Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 27th, 2012  |  syntax: None  |  size: 1.88 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import java.io.*;
  2. import java.util.*;
  3. import java.math.*;
  4.  
  5. public class ${primary_type_name} implements Runnable {
  6.         public static void main(String[] args) {
  7.                 new ${primary_type_name}().run();
  8.         }
  9.  
  10.         class FastScanner {
  11.                 BufferedReader br;
  12.                 StringTokenizer st;
  13.                 boolean eof;
  14.                 String buf;
  15.  
  16.                 public FastScanner(String fileName) throws FileNotFoundException {
  17.                         br = new BufferedReader(new FileReader(fileName));
  18.                         nextToken();
  19.                 }
  20.  
  21.                 public FastScanner(InputStream stream) {
  22.                         br = new BufferedReader(new InputStreamReader(stream));
  23.                         nextToken();
  24.                 }
  25.  
  26.                 String nextToken() {
  27.                         while (st == null || !st.hasMoreTokens()) {
  28.                                 try {
  29.                                         st = new StringTokenizer(br.readLine());
  30.                                 } catch (Exception e) {
  31.                                         eof = true;
  32.                                         break;
  33.                                 }
  34.                         }
  35.                         String ret = buf;
  36.                         buf = eof ? "-1" : st.nextToken();
  37.                         return ret;
  38.                 }
  39.  
  40.                 int nextInt() {
  41.                         return Integer.parseInt(nextToken());
  42.                 }
  43.  
  44.                 long nextLong() {
  45.                         return Long.parseLong(nextToken());
  46.                 }
  47.  
  48.                 double nextDouble() {
  49.                         return Double.parseDouble(nextToken());
  50.                 }
  51.  
  52.                 BigInteger nextBigInteger() {
  53.                         return new BigInteger(nextToken());
  54.                 }
  55.  
  56.                 void close() {
  57.                         try {
  58.                                 br.close();
  59.                         } catch (Exception e) {
  60.  
  61.                         }
  62.                 }
  63.  
  64.                 boolean isEOF() {
  65.                         return eof;
  66.                 }
  67.         }
  68.  
  69.         FastScanner sc;
  70.         PrintWriter out;
  71.  
  72.         public void run() {
  73.                 Locale.setDefault(Locale.US);
  74.                 try {
  75.                         sc = new FastScanner("${fn}.in");
  76.                         out = new PrintWriter("${fn}.out");
  77.                         solve();
  78.                         sc.close();
  79.                         out.close();
  80.                 } catch (Throwable e) {
  81.                         e.printStackTrace();
  82.                         System.exit(1);
  83.                 }
  84.         }
  85.  
  86.         int nextInt() {
  87.                 return sc.nextInt();
  88.         }
  89.  
  90.         String nextToken() {
  91.                 return sc.nextToken();
  92.         }
  93.  
  94.         long nextLong() {
  95.                 return sc.nextLong();
  96.         }
  97.  
  98.         double nextDouble() {
  99.                 return sc.nextDouble();
  100.         }
  101.  
  102.         BigInteger nextBigInteger() {
  103.                 return sc.nextBigInteger();
  104.         }      
  105.  
  106.         void solve() {
  107.                 ${cursor}
  108.         }
  109. }