Skip to content

Instantly share code, notes, and snippets.

@shashankrnr32
Created December 13, 2021 07:28
Show Gist options
  • Save shashankrnr32/002fde7d24452121aaa64ec7b6b8ee76 to your computer and use it in GitHub Desktop.
Save shashankrnr32/002fde7d24452121aaa64ec7b6b8ee76 to your computer and use it in GitHub Desktop.
/* Easy to use simple code snippet that can be used as a starting point for Competitve Programming */
/* Do not import new packages to the program unless allowed by the interviewer*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
/* Here is where the execution starts */
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
final int cases;
try {
/*
Indicates the first line of input file. Usually gives the number of testcases present in the file.
For each testcase, you must read and compute the output
*/
cases = Integer.parseInt(br.readLine().trim());
TestCaseSolver solver = new TestCaseSolver();
for (int i = 0; i < cases; i++) {
solver.readInput(br);
System.out.println(solver.solve());
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
class TestCaseSolver {
/* Add variables needed for this testcase */
/* Add your logic to console input from buffered reader */
public void readInput(BufferedReader reader) {
}
/* This is where you will use the variables you populated in `readInput` to solve the problem for this testcase */
/* Change the return type based on the problem */
public String solve() {
/* Add your logic here */
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment