prashant.2k03's blog

By prashant.2k03, 11 years ago, In English

hello all, i m new to codeforces. i want to ask many of the probems contain this as given constraint input:input.txt output:output.txt can anyone explain what does these refer to ??? do i have to take input from input.txt and produce the output by creating a file output.txt

  • Vote: I like it
  • -5
  • Vote: I do not like it

| Write comment?
»
11 years ago, # |
  Vote: I like it +6 Vote: I do not like it

usually u work with console (stdin, stdout). Howewer, when author say to use files, u will use files.

»
11 years ago, # |
Rev. 2   Vote: I like it +10 Vote: I do not like it

You have to take input from the file named : input.txt and you have to produce output to file named : output.txt , Note that you are not allowed to create output.txt. For every sumbmission you will be provided an already created input.txt and output.txt file. So do not worry about creating it. Just write your contents on it. eg. In C++ : freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);

Normally if input and output files are not mentioned then you have to do Input Output from stdin and stdout. For this you do not need to add anything to your code , beucase normal Input Output happens from stdin and stdout.

  • »
    »
    5 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thanks a lot for your help!

    Struggled in a question thinking which file is missing.....came here and got the solution!

»
23 months ago, # |
  Vote: I like it -12 Vote: I do not like it

In C++ Keep the following macro in your code:

#define TxtIO   freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);

In the main function declear it as follows:

int main() 
{
        TxtIO;
        /* CODE */
        return 0;
}