kk_ducviet's blog

By kk_ducviet, 10 years ago, In English

Most coders read input from file and write out to another, but some online judge likes CodeForces use stdin. When solving problems in a contest, eveyone always want to minimum submission time, these little code may help:


freopen(fi, "r", stdin);
freopen(fo, "w", stdout);
// online submission


{online submission}
{read & write file}

Why? Because on the online judge, ONLINE_JUDGE is defined to be true in C/C++

Notice that it also works on UVa, some others too but I didn't test it :)

Full text and comments »

  • Vote: I like it
  • +6
  • Vote: I do not like it