I think you can use

System.setIn(new FileInputStream("code_jam_input_file.txt"));
System.setOut(new PrintStream("code_jam_output_file.txt"));

These two line should let you read from txt file and write to a txt file.

Parker

On 2013/3/30 21:37, Chandra Sekhar wrote:
Hi All,

I am going to participate Google Code JAM 2013. So before that I thought to practice a bit. I found the inputs are given in a file and the output is expected in a file only. So my question is do I need to write some IO operations to read the question from file and after calculating the output do I again need to write that back to another destination file through code.

Or I can copy the the input file contents to my code and just write the code and after getting the output in the console, I can copy the output to a file to send as output file.

    For Example: the input of a contest

3
100
3
5 75 25


    Can I write the code like

    int index = 3, credit = 100, noOfProducts = 3;
    int[] prices = {5,75,25};

    //Code to calculate output starts here

System.out.print(output);
//After getting the output into console copy it into a file and send it as an output file.



    Or I need to write like this

    FileInputStream fis = new FileInputStream("code_jam_input_file.txt");
//read the input file and parse the content and then start calculating the output

//After getting the output write back it to a destination output file and then send it to Google.




Thanks.
--
You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/google-code/-/867rZfbqOKgJ.
For more options, visit https://groups.google.com/groups/opt_out.



--
You received this message because you are subscribed to the Google Groups "Google 
Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to