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

Обсуждение задачи 1360. Философский спор

WA on Test 4
Послано Armen Tsirunyan 5 окт 2009 16:00
Hi, everyone. I hate this problem, too, but there's a strange thing going on with test 4. My algorithm is very straightforward and it cannot possibly lead to a WA. It could be a TLE, I admit, but can anybody explain to me HOW is WA possible with this code?

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    double t = 0;
    double eps;
    double x, y;
    cin>>x>>y>>eps;


    eps*=eps;
    t = 0;
    while(true)
    {
        double c = cos(t) - y;
        double d = sin(pow(t,0.5)) - x ;
        if( c*c+d*d > eps/2)
            t+=0.007;
        else
        {
            break;
        }
    }
        cout<<t;
    return 0;
}
Re: WA on Test 4
Послано Armen Tsirunyan 5 окт 2009 18:41
OK, I got AC. And I found my mistake. And inasmuch as I do hate this problem, and don't think this is a good problem, I want to tell everybody how to solve it. So, first of all, output the answer with precision 10^-5; Second of all, find the smallest positive t, such that cos(t) = y; Then while(sin(sqrt(t)) !~ x) t+=2pi. That's all. Good luck with this goddamn(this isn't a taboo word, is it?:)) problrm
Re: WA on Test 4
Послано Alexander Samal 22 ноя 2009 21:41
Thank you for your advice!
Whith it I got AC without any WA!:)