@Test public void testInit() throws Exception { String inputStr = "D1 D3 E5"; ByteArrayInputStream in = new ByteArrayInputStream(inputStr.getBytes(StandardCharsets.UTF_8)); ByteArrayOutputStream out = new ByteArrayOutputStream(); Main.init(in, out); assertEquals("29", out.toString()); }
public static void main(String args[]) throws NumberFormatException, IOException { Scanner sc = new Scanner(); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); init(); int P = sc.nextInt(); for (int i = 0; i < P; i++) { int a = sc.nextInt(); int b = sc.nextInt(); int k = sc.nextInt(); if (k > 12) bw.write("0\n"); else { int ans = matrix[k - 1][b] - matrix[k - 1][a - 1]; bw.write(ans + "\n"); } } bw.flush(); }
void init(final TextBuiltin cmd) throws IOException { cmd.outs = result.out; cmd.errs = result.err; super.init(cmd); }