## Search found 16 matches

Thu Feb 06, 2003 4:13 pm
Forum: Volume 104 (10400-10499)
Topic: 10439 - Temple of Dune
Replies: 15
Views: 5551
I wonder my algorithm has some precision problem, but I don`t know how to avoid that problem. In my accepted solution, i have used the following function to check if a is a multiple of b : [cpp] inline bool IsAMultipleOf( double num, double div ) { const double l = num/div ; double dl = fabs(l-(int...
Thu Feb 06, 2003 11:27 am
Forum: Volume 104 (10400-10499)
Topic: 10424 - Love Calculator
Replies: 137
Views: 40560
Oh yes, and one more thing that we need to be very careful, the input-description doesn't mention that each word will be in a line by itself. -turuthok- I though about that case but problem description also says that a word can contain white spaces. how do you consider such a line : a a b b ? "a a"...
Thu Feb 06, 2003 10:34 am
Forum: Volume 104 (10400-10499)
Topic: 10424 - Love Calculator
Replies: 137
Views: 40560
Hi,

This problem seems easy but i think i have excatly the same problem as u.
Is there any special case to consider, or is it a precision problem
Any tip or I/O data appreciated
Thanks
Wed Feb 05, 2003 11:52 pm
Forum: Volume 104 (10400-10499)
Topic: 10439 - Temple of Dune
Replies: 15
Views: 5551
To gvcormac

Thanks for your suggestions, i have finally solved the problem.
As you suggest, GCD is not necessary ( and subject to precision errors) as we now the maximum number of vertices.

Wed Feb 05, 2003 6:53 pm
Forum: Volume 104 (10400-10499)
Topic: 10439 - Temple of Dune
Replies: 15
Views: 5551
I do not understand why v shouldn't divide 2*PI (because we are trying to find a regular polygon).
In all sample cases, 2*PI was a multiple of v (+/- epsilon)

Could u please give some cases where this is not true.

Thanks
Wed Feb 05, 2003 4:13 pm
Forum: Volume 104 (10400-10499)
Topic: 10439 - Temple of Dune
Replies: 15
Views: 5551
To gvcormac : obiously, the gcd i compute is a floating number. I cast to integer like that : [cpp] const double v = GCD( theta1, theta2) ; const int verticeCount = (int)(0.1 + (2*PI)/v) ; [/cpp] I think this is correct to Andrey : the angles i need are the angle of the vectors from center of circle...
Tue Feb 04, 2003 8:59 pm
Forum: Volume 104 (10400-10499)
Topic: 10439 - Temple of Dune
Replies: 15
Views: 5551

### 10439 - Temple of Dune

I can't figure why i always get WA. I get correct results for sample cases Is there any special test case with this problem ? I think my algorithm is good : 1. find the circle through the 3 points 2. find three angles a1, a2, a3 (sorted) 3. compute the gcd( ( a2-1), (a3-a1)) 4. result = (2*PI)/gcd I...
Mon Jan 13, 2003 2:07 pm
Forum: Volume 103 (10300-10399)
Topic: 10326 - The Polynomial Equation
Replies: 18
Views: 6233
to tat tvam asi :

i used long long to store coefficients and now got AC
many thanks for ur help
Sun Dec 29, 2002 5:30 pm
Forum: Volume 103 (10300-10399)
Topic: 10326 - The Polynomial Equation
Replies: 18
Views: 6233
But my program output is correct in the case 1 0

Really don't know where is the mistake
Sun Dec 29, 2002 4:15 pm
Forum: Volume 103 (10300-10399)
Topic: 10343 - Base64 Decoding
Replies: 20
Views: 7979
stupid mistake
got AC now
Wed Dec 04, 2002 9:15 am
Forum: Volume 100 (10000-10099)
Topic: 10042 - Smith Numbers
Replies: 75
Views: 23798
A prime number is not a smith's number.
You don't check this point in your program

Hope this helps
Fri Nov 22, 2002 8:46 pm
Forum: Volume 103 (10300-10399)
Topic: 10316 - Airline Hub
Replies: 25
Views: 7835
Hi, I don't know if your formula is correct but in my solution (got AC) i do not convert from (latitude,longitude) to 3D coordinates. I directly compute the distance on the great arc using latitude and longitude with the following formula (no need for epsilon) : [cpp] struct CNode { CNode() {} inlin...
Wed Nov 20, 2002 5:13 pm
Forum: Volume 103 (10300-10399)
Topic: 10343 - Base64 Decoding
Replies: 20
Views: 7979
Hi, I read all posts about problem 10343 but always get WA. The description of the problem says that " Each dataset consists of a valid Base64 encoding of some (possibly binary) data ". But how can i take this binary data into account ? Here the code i have submitted Thanks for any help [cpp] #inclu...
Wed Nov 20, 2002 5:09 pm
Forum: Other words
Topic: 10342 and 10342 is fixed now
Replies: 10
Views: 3768
Hi, I read all posts about problem 10343 but always get WA. The description of the problem says that " Each dataset consists of a valid Base64 encoding of some (possibly binary) data ". But how can i take this binary data into account ? Here the code i have submitted Thanks for any help [cpp] #inclu...
Wed Nov 20, 2002 5:00 pm
Forum: Volume 103 (10300-10399)
Topic: 10326 - The Polynomial Equation
Replies: 18
Views: 6233
i have the same problem N submissions and N WA (N>10) thanks for any help here is my code: [cpp] #include <stdio.h> inline int Abs( int i ) { return ( i > 0 ) ? i : -i ; } inline double Abs( double i ) { return ( i > 0 ) ? i : -i ; } template <class CoefficientType, int MaxPower> class CPolynome { p...