## 10209 - Is This Integration ?

Moderator: Board moderators

turcse143
Learning poster
Posts: 81
Joined: Wed May 09, 2007 9:59 pm
thanks i got AC.
it was a simple mistake.
& i was fool
''I want to be most laziest person in the world''

riisiingsun
New poster
Posts: 4
Joined: Fri May 18, 2007 12:03 pm

### 10209 equations

for prob 10209
3rd eqn: 2x+y+z=(pi/3 - sqrt(3)/4)a^2
tri.JPG (35.27 KiB) Viewed 2259 times
2x+y+z
= ((1/2) * s * a) - ((1/2) * c * (a/2))
= ((1/2) * a * (2/3) * pi * a) - (.5 * sqrt(3)*r * (r/2))
= ((1/3) * pi * a^2) - (sqrt(3)/4 r^2)
= ((1/3) * pi - sqrt(3)/4) * a^2
R!!\$!!NG\$UN

cyclops_kun
New poster
Posts: 4
Joined: Mon Dec 08, 2008 11:03 am

### I got AC in UVa judge, but i got WA in Programming-challenge

I got AC in UVa judge, but why i got WA in http://www.programming-challenges.com judge? I don't understand..
I'm sorry posting my AC code here , but, for me it's still WA , coz it's WA in programming-challenges, please help..thanks in advance..

Here is my code, for anyone who got AC, please try at http://www.programming-challenges.com and please tell me why i got WA there?

Code: Select all

``````#include<iostream>
#include<cmath>
#include<iomanip>
#define eps 1e-6
#define pi 2.0*acos(0.0)//3.1415926535897932384626433832795     //you can choose between two these pi value, both AC

using namespace std;

double LSegitiga(double a);

int main()
{
double a, L1, L2, L3;

cout<<fixed<<showpoint<<setprecision(3);
while(cin>>a)
{
L1 = 4*(a*a - (pi*a*a/6 + LSegitiga(a)));
L2 = 4*(a*a - (pi*a*a/4 + L1/2));
L3 = a*a-L1-L2;
cout<<L3+eps<<" "<<L2+eps<<" "<<L1+eps<<endl;
}
return 0;
}

double LSegitiga(double a)
{
double s=(3*a)/2;

return sqrt(s*(s-a)*(s-a)*(s-a));
}

``````

Saswat2603
New poster
Posts: 15
Joined: Tue Feb 12, 2008 10:42 am
Location: Bhubaneswar, Orissa, India

### Faster Floating Point Calculations ??

Hi all.

I solved this problem all by myself in 0.110 sec( it was an easy one ).
I checked the problem stats and was surprised 2 find many ppl with 0.000 sec timing !!

R there faster methods 4 solving this problem ??
2 b more specific, this problem would require a total of 3 multiplications and 2 additions ( & subtractions ) :

--> Calculate A2 = A*A : 1 multiplication
--> Calculate Stripped_Area = A2 * k1 : 1 multiplication
--> Calculate Dotted_Area = A2 * k2 : 1 multiplication
--> Calculate Rest = A2 - ( Dotted_Area + Stripped_Area ) : 2 Additions

So, r there faster methods 4 floating point calculations ?? ( 'cuz i don't think this can b solved with any less no. of operations )
Last edited by Saswat2603 on Tue Jan 06, 2009 3:23 pm, edited 1 time in total.
Saswat Padhi - lost in for(;;);

Saswat2603
New poster
Posts: 15
Joined: Tue Feb 12, 2008 10:42 am
Location: Bhubaneswar, Orissa, India

### Re: 10209 - Is This Integration ?

I finally reduced my time to 0.070 sec , with much pain.
Saswat Padhi - lost in for(;;);

vahid sanei
Learning poster
Posts: 84
Joined: Fri Jan 09, 2009 4:37 pm
Location: IRAN

### Re: 10209 - Is This Integration ?

why i get WA
I`m sure my solution is correct

Code: Select all

``removed``
Last edited by vahid sanei on Thu Feb 05, 2009 11:06 am, edited 1 time in total.
Impossible says I`m possible

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am

### Re: 10209 - Is This Integration ?

for double and long double you shouldn't use == operation..
So this part

Code: Select all

``if(r==0)``
can be replaced by..

Code: Select all

``if(fabs(r-0)<0.00001)``
And you declared the variables as long double. But why you used this

Code: Select all

``printf("%.3lf %.3lf %.3lf\n",D,A,B);``
you should use llf.. like this

Code: Select all

``printf("%.3llf %.3llf %.3llf\n",D,A,B);``
hope you will get acc..
try_try_try_try_&&&_try@try.com
This may be the address of success.

vahid sanei
Learning poster
Posts: 84
Joined: Fri Jan 09, 2009 4:37 pm
Location: IRAN

### Re: 10209 - Is This Integration ?

just i changed long double to double ,
and i got acc
it`s very strange
already i tested this but i got WA , I don`t know
TY Obaida
Impossible says I`m possible