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 1084. Goat in the Garden

!!!! MESSAGE FOR THE ADMINISTRATORS !!!!
Posted by Manastireanu 9 Apr 2005 14:24
//There seams to be a problem with your C++ compiler.
//It doesn't support #include<math.h>
//In many problems I tried to use MATH.H, but I always got //COMPILATION ERROR.
//Please take my notice into consideration and fix, if //possible, the problem.

Thank you.
I solved the problem. :D
Look at my other post to see the solution. :D

Edited by author 09.04.2005 15:27


Edited by author 10.04.2005 17:21
READ FAQ! (+)
Posted by Victor Barinov (TNU) 9 Apr 2005 14:56
You got CE, because, maybe your code have the next lines:

#include <math.h>
...
int n;
...
sqrt(n);
...

if you change
sqrt(n);
to
sqrt((double)n);

You will not get CE!

Sorry for my poor English :)
Re: READ FAQ! (+)
Posted by Manastireanu 9 Apr 2005 15:26
I don't have any integer variables. (int n)
I use float.
float n;
sqrt(n);
I tried also with double n; but I still get compilation error.
Write me letter... (+)
Posted by Victor Barinov (TNU) 9 Apr 2005 19:05
Send me your source to victorbarinov@ua.fm
If you know Russian language, say please. Bue!
Re: Write me letter... (+)
Posted by Manastireanu 10 Apr 2005 14:25
I sent you an email containing my code.
Please take a look.
I'm sorry but I don't know Russian.
My email is danmana11@yahoo.com
I sent the answer to You. (+)
Posted by Victor Barinov (TNU) 10 Apr 2005 16:34
If you not recieve my letter...

change  sqrt(2)  to  sqrt(2.0)

in C

2 - integer value
2.0 - double value
Re: I sent the answer to You. (+)
Posted by Manastireanu 10 Apr 2005 17:13
Thank you very much I got AC.
I was able to get AC other problems in witch I had the same error.
I also got AC with the same code, but in C (with sqrt(2)).

It seams that only C++ has this problem.

So my conclusion :
in C++ use sqrt(2.0); //sqrt(2); produces CE
in C it is ok to use sqrt(2);

Thank you very much for your help.  :D