Search found 2 matches

by seogi81
Tue Feb 07, 2006 1:18 pm
Forum: Volume 101 (10100-10199)
Topic: 10193 - All You Need Is Love
Replies: 23
Views: 13896

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"
by seogi81
Mon Feb 06, 2006 4:00 pm
Forum: Volume 101 (10100-10199)
Topic: 10154 - Weights and Measures
Replies: 60
Views: 48656

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

Go to advanced search