Tips and Tricks Session 1 will cover setting up your workspace for ICPC-like competitions, I/O in Java, and fundamental algebra and arithmetic problems.
Here is the skeleton that you should use for all ICPC-type problems from now through the end of the semester:
package _____;
import java.io.*;
import java.util.Scanner;
/**
* Problem ____: ________
*/
public class Main {
public static void main(String[] args) throws IOException {
// For STDIN, put two stars below.
// For File In, put one star below.
/*/
Scanner scanner = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
/*/
Scanner scanner = new Scanner(new BufferedReader(new InputStreamReader(new FileInputStream("_______/sample.in"))));
/**/
while (scanner.hasNextInt()) {
// your solution goes here.
// Example line: int n = scanner.nextInt();
}
}
}
To copy the above code, press the “view source” button in the upper-right corner.
There are four fill-in-the-blanks: the package name, the problem ID, the problem name, and then the package name again (in the FileInputStream line).
[...] in the code from this post, filling in the blanks as [...]