I think it is a simple GCD problem..
if GCD( i, j ) > 1 "all you need is love"
else "love is not all you need"
Search found 2 matches
Search found 2 matches • Page 1 of 1
- Mon Feb 06, 2006 4:00 pm
- Forum: Volume 101 (10100-10199)
- Topic: 10154 - Weights and Measures
- Replies: 60
- Views: 40455
I used DP Let me explain my algorithm. first, sort turtles by strength.. Let, H[n][w] = maximum stack height, using 1'st~n'th turtles. and total weight is no more than 'w' H[n][w] = 1 (if n=1 and weight[n] <= w) 0 (if n=1 and weight[n] > w) this is initialization.. and recursively, H[n][w] = max( H[...