Page 3 of 3

Posted: Thu Feb 28, 2008 8:10 pm
by turcse143
thanks i got AC.
it was a simple mistake.
& i was fool

10209 equations

Posted: Mon Apr 07, 2008 10:26 pm
by riisiingsun
for prob 10209
3rd eqn: 2x+y+z=(pi/3 - sqrt(3)/4)a^2
tri.JPG
tri.JPG (35.27 KiB) Viewed 3201 times
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

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

Posted: Mon Dec 08, 2008 11:54 am
by cyclops_kun
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 :cry: , 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));
}


Faster Floating Point Calculations ??

Posted: Sat Dec 13, 2008 3:31 pm
by Saswat2603
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 :o ppl with 0.000 sec :o :o :o 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 :-? :-? )

Re: 10209 - Is This Integration ?

Posted: Tue Jan 06, 2009 3:23 pm
by Saswat2603
I finally reduced my time to 0.070 sec :D :D :D , with much pain.

Re: 10209 - Is This Integration ?

Posted: Thu Feb 05, 2009 9:48 am
by vahid sanei
why i get WA
I`m sure my solution is correct
PLEASE HELP ME

Code: Select all

removed

Re: 10209 - Is This Integration ?

Posted: Thu Feb 05, 2009 10:54 am
by Obaida
Your code got small bug....
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 :o

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.. :D

Re: 10209 - Is This Integration ?

Posted: Thu Feb 05, 2009 11:05 am
by vahid sanei
:oops:
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 :D