| 
 | 
вернуться в форумWA on Test 4 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 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 Thank you for your advice! Whith it I got AC without any WA!:)  |  
  | 
|