Page 1 of 1

10434 - Working With Specific Gravity

Posted: Wed Nov 15, 2006 7:53 am
by yoshiro aoki
The problem is not a big deal, but watch out that you use a good pi value.
I used 3.14159 from memory, but it was not good enough.

Pi is in math.h, and on MS compilers its ifdef'd out.
here it is: 3.14159265358979323846, u can borrow it :wink:

Maybe best to copy & paste it to a variable on such platforms as the required #define is not standard C++ & may give compile errors on the Judge.

good luck :)

Re: 10434: Working with Specific Gravity

Posted: Wed Nov 15, 2006 9:36 pm
by Jan
yoshiro aoki wrote:Maybe best to copy & paste it to a variable on such platforms as the required #define is not standard C++ & may give compile errors on the Judge.
I dont understand what are you saying. You can use

Code: Select all

#define Pi (2*acos(0.0))
And this works perfectly. And there is one multiplication. So, you can store it in a variable.

Code: Select all

double pi = 2*acos(0.0);
You have to include math.h for the acos() function. Thats all.

Posted: Wed Nov 15, 2006 10:35 pm
by yoshiro aoki
Im sorry that you cannot understand it, but I cannot make it more clear than what I have already said. :( I hope someone else may be able to help you.

have a good day