ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1047. Simple Calculations

What's wrong with output using "cout"? When I changed it on "printf", I got AC
Posted by Osama Ben Laden 20 Feb 2002 17:10
I thought, that these 2 codes are equal:

 cout.precision(2);
 cout.setf(ios::showpoint || ios::fixed);
 cout<<res<<'\n';

OR

 printf("%0.2f",res);

Can anybody explain it me. Maybe, something wrong with GNU C++?
I had even a much BIGGER problem
Posted by Algorist 20 Feb 2002 17:54
Well, it does not work always :)) I do not know why, but the truth is
that on different PCs these do not work identically....... a BIG BUG

But I had even a bigger problem. I submitted a solution of problem
1176 (in fact, I submitted four different solutions over 30
times ;) ), but I always got TL exceeded. I always used cin/cout. I
changed cin to scanf() and cout to printf() and all was OK -> my
solution got AC, having in mind that
1. When using CIN/COUT it worked over the time limit i.e. more than 2
secs
2. When I changed them to scanf/printf i got AC and my program worked
0.9 secs............

So-> I advice you -> always use printf, scanf and all the C stuff :))
C++ input/output has lots of bugs, and as it seems, it si quite
slow.............
Thanks!!!
Posted by Osama Ben Laden 20 Feb 2002 22:34