-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUSACO1.java
More file actions
23 lines (22 loc) · 933 Bytes
/
Copy pathUSACO1.java
File metadata and controls
23 lines (22 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
ID: achyuta2
LANG: JAVA
TASK: test
*/
import java.io.*;
import java.util.*;
class test {
public static void main (String [] args) throws IOException {
// Use BufferedReader rather than RandomAccessFile; it's much faster
BufferedReader f = new BufferedReader(new FileReader("test.in"));
// input file name goes above
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("test.out")));
// Use StringTokenizer vs. readLine/split -- lots faster
StringTokenizer st = new StringTokenizer(f.readLine());
// Get line, break into tokens
int i1 = Integer.parseInt(st.nextToken()); // first integer
int i2 = Integer.parseInt(st.nextToken()); // second integer
out.println(i1+i2); // output result
out.close(); // close the output file
}
}