/* * Solution Template for Sitting or Standing? * * This file is provided to assist with reading of input and writing of output * for the problem. You may modify this file however you wish, or * you may choose not to use this file at all. */ import java.io.*; class Solution { private static int r; private static int s; private static int num_tickets; private static int num_sitting; private static int num_standing; /* * Read the next token from the input file. * Tokens are separated by whitespace, i.e., spaces, tabs and newlines. * If end-of-file is reached then an empty string is returned. */ private static String readToken(BufferedReader in) throws IOException { StringBuffer ans = new StringBuffer(); int next; /* Skip any initial whitespace. */ next = in.read(); while (next >= 0 && Character.isWhitespace((char)next)) next = in.read(); /* Read the following token. */ while (next >= 0 && ! Character.isWhitespace((char)next)) { ans.append((char)next); next = in.read(); } return ans.toString(); } public static void main(String[] args) throws IOException { /* Open the input and output streams for stdin and stdout. */ BufferedReader input_reader = new BufferedReader(new InputStreamReader( System.in)); BufferedWriter output_writer = new BufferedWriter( new OutputStreamWriter(System.out)); /* Read the input. */ r = Integer.parseInt(readToken(input_reader)); s = Integer.parseInt(readToken(input_reader)); num_tickets = Integer.parseInt(readToken(input_reader)); /* * TODO: This is where you should compute the answers and store them * into the variables num_sitting and num_standing. */ /* Write the answer. */ output_writer.write(num_sitting + " " + num_standing + "\n"); /* Close the input_reader and output_writer. */ input_reader.close(); output_writer.close(); } }