10209 - Is This Integration ?
Moderator: Board moderators
-
- New poster
- Posts: 4
- Joined: Fri May 18, 2007 12:03 pm
- Location: Bangladesh
10209 equations
for prob 10209
3rd eqn: 2x+y+z=(pi/3 - sqrt(3)/4)a^2
2x+y+z
= ((1/2) * s * a) - ((1/2) * c * (a/2))
= yellow shade of circle
= ((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
3rd eqn: 2x+y+z=(pi/3 - sqrt(3)/4)a^2
2x+y+z
= ((1/2) * s * a) - ((1/2) * c * (a/2))
= yellow shade of circle
= ((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
-
- 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
Please Help..
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?
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



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));
}
-
- 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
)
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




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(;;);
-
- 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(;;);
-
- Learning poster
- Posts: 84
- Joined: Fri Jan 09, 2009 4:37 pm
- Location: IRAN
Re: 10209 - Is This Integration ?
Last edited by vahid sanei on Thu Feb 05, 2009 11:06 am, edited 1 time in total.
Impossible says I`m possible
Re: 10209 - Is This Integration ?
Your code got small bug....
for double and long double you shouldn't use == operation..
So this part
can be replaced by..
And you declared the variables as long double. But why you used this
you should use llf.. like this
hope you will get acc.. 
for double and long double you shouldn't use == operation..
So this part
Code: Select all
if(r==0)
Code: Select all
if(fabs(r-0)<0.00001)

Code: Select all
printf("%.3lf %.3lf %.3lf\n",D,A,B);
Code: Select all
printf("%.3llf %.3llf %.3llf\n",D,A,B);

try_try_try_try_&&&_try@try.com
This may be the address of success.
This may be the address of success.
-
- 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