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 1360. Philosophical Dispute

WA on Test 4
Posted by Armen Tsirunyan 5 Oct 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
Posted by Armen Tsirunyan 5 Oct 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
Posted by Alexander Samal 22 Nov 2009 21:41
Thank you for your advice!
Whith it I got AC without any WA!:)