ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1047. Простые вычисления

What's wrong with output using "cout"? When I changed it on "printf", I got AC
Послано Osama Ben Laden 20 фев 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
Послано Algorist 20 фев 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!!!
Послано Osama Ben Laden 20 фев 2002 22:34