java usaco code

Solutions on MaxInterview for java usaco code by the best coders in the world

showing results for - "java usaco code"
Timothy
30 Feb 2017
1/* Use the slash-star style comments or the system won't see your
2   identification information */
3/*
4ID: your_id_here
5LANG: JAVA
6TASK: test
7*/
8import java.io.*;
9import java.util.*;
10
11class test {
12  public static void main (String [] args) throws IOException {
13    // Use BufferedReader rather than RandomAccessFile; it's much faster
14    BufferedReader f = new BufferedReader(new FileReader("test.in"));
15                                                  // input file name goes above
16    PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("test.out")));
17    // Use StringTokenizer vs. readLine/split -- lots faster
18    StringTokenizer st = new StringTokenizer(f.readLine());
19						  // Get line, break into tokens
20    int i1 = Integer.parseInt(st.nextToken());    // first integer
21    int i2 = Integer.parseInt(st.nextToken());    // second integer
22    out.println(i1+i2);                           // output result
23    out.close();                                  // close the output file
24  }
25}