Search found 25 matches

by goodwill
Sun Oct 07, 2007 12:05 pm
Forum: Volume 113 (11300-11399)
Topic: 11307 - Alternative Arborescence
Replies: 22
Views: 10933

You may find this O(n) algorithm interesting (no need to know how many color there are).
http://citeseer.ist.psu.edu/494676.html
by goodwill
Sun Oct 07, 2007 12:02 pm
Forum: Volume 112 (11200-11299)
Topic: 11293 - Tournament
Replies: 19
Views: 6680

Thanks. I got it.
by goodwill
Fri Oct 05, 2007 4:37 pm
Forum: Volume 112 (11200-11299)
Topic: 11293 - Tournament
Replies: 19
Views: 6680

How do you prove the greedy is always correct?
by goodwill
Fri Oct 05, 2007 4:34 pm
Forum: Volume 112 (11200-11299)
Topic: 11294 - Wedding
Replies: 21
Views: 8808

Yes, you are right. My AC output is the same as yours.
by goodwill
Tue Oct 02, 2007 3:32 pm
Forum: Volume 113 (11300-11399)
Topic: 11300 - Spreading the Wealth
Replies: 14
Views: 5676

I used a nlogn algorithm for finding median. Is there any better algorithm?
by goodwill
Tue Oct 02, 2007 7:42 am
Forum: Volume 113 (11300-11399)
Topic: 11302 - Hexadecimal Digits of an Integral
Replies: 10
Views: 2803

AC Finally. Thank you all. Just "guess" the constant.
by goodwill
Mon Oct 01, 2007 3:38 pm
Forum: Volume 113 (11300-11399)
Topic: 11302 - Hexadecimal Digits of an Integral
Replies: 10
Views: 2803

The first product is ln2 but i still don't know what is the value of ln(1+x^2)/(x+1)dx
by goodwill
Mon Oct 01, 2007 12:02 pm
Forum: Volume 112 (11200-11299)
Topic: 11298 - Dissecting a Hexagon
Replies: 25
Views: 8402

I read a paper and it said that :
For a n-gon (n>=5), there is no way to dissect it into m triangles with equal area with gcd(n,m)=1.
by goodwill
Mon Oct 01, 2007 6:13 am
Forum: Volume 112 (11200-11299)
Topic: 11298 - Dissecting a Hexagon
Replies: 25
Views: 8402

AC now after using string to read input!!!
by goodwill
Sat Sep 29, 2007 2:12 am
Forum: Volume 107 (10700-10799)
Topic: 10749 - Automobile Travelling
Replies: 9
Views: 5248

My output has the same number of moves as your output. Could you please check what's wrong with my code : #include <iostream> #define MAXK 1005 #define MAXP 15 #define MAXQ 15 using namespace std; int m,n,k,p,q,x0,y0,k0; bool c[MAXK][MAXK]; int pq[MAXK*(MAXP+1)*(2*MAXQ+1)*3]; int d[MAXK],a[MAXK]; in...
by goodwill
Fri Sep 28, 2007 3:17 pm
Forum: Volume 107 (10700-10799)
Topic: 10749 - Automobile Travelling
Replies: 9
Views: 5248

Help me! plz

Could someone give me the output for this input? 20 31 31 9 4 0 1 0 0 0 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 1 0 1 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 ...
by goodwill
Wed Sep 26, 2007 5:31 am
Forum: Volume 112 (11200-11299)
Topic: 11287 - Pseudoprime Numbers
Replies: 11
Views: 5116

In the case where n is odd, it should be :

Code: Select all

return (square(BigMod(a, n/2, p))%p)*(a % p) % p; 
by goodwill
Tue Sep 18, 2007 3:43 pm
Forum: Volume 112 (11200-11299)
Topic: 11281 - Triangular Pegs in Round Holes
Replies: 26
Views: 11083

i change your program to compute the condition for all 3 edges of the triangle and it got AC: bool valid(double a, double b, double c, double d){ double theta, alpha, eta, xx; if( a - d > eps ) return false ; theta = acos( ( a*a + b*b - c*c )/(2*a*b) ) ; alpha = acos( a/d ); // since D[j] = 2*r ; et...
by goodwill
Tue Sep 18, 2007 1:03 am
Forum: Volume 112 (11200-11299)
Topic: 11280 - Flying to Fredericton
Replies: 43
Views: 16580

Code: Select all

dp(x,y) = min{dp(x,y), dp(i, y-1)+cost(i,x)}; 
It's the same as my AC code and i only considers flight (i,j) where i<j.
by goodwill
Tue Sep 18, 2007 12:57 am
Forum: Volume 112 (11200-11299)
Topic: 11281 - Triangular Pegs in Round Holes
Replies: 26
Views: 11083

theta = acos( ( a*a + b*b - c*c )/(2*a*b) ) ; alpha = acos( a/D[j] ); // since D[j] = 2*r ; I believe that you have used the wrong angle. I used this one theta = acos( ( a*a + b*b - c*c )/(2*a*b) ) ; alpha = asin(c/D[j] ); if (alpha-theta>-eps) ... And you used it for all 3 edges of the triangle.[/...

Go to advanced search