The algo is easy, but the idea is not quite...(-)
Послано
SPIRiT 9 окт 2006 17:02
Re: The algo is easy, but the idea is not quite...(-)
Послано
svr 10 окт 2006 00:55
I have Ac(0.015) by diagonal sequantal placing nambers 1..N*N from max and min alternating
25 2 22 6 2 17
1 23 5 18 10
24 4 19 9 14
3 20 8 15 12
21 7 16 11 13
but clear mathamatic proof i don't now and this is most interesting. I will try find out such proof and if people will have interest will send this proof to forum. Without proof algotithm hasn't hard foundation.
That would be interesting, I'm also trying to prove it. (-)
-
Re: The algo is easy, but the idea is not quite...(-)
Послано
Alexey 17 окт 2006 13:50
So, what is your algo, svr?
After building your matrix, what are you doing?
Thanks.
Edited by author 17.10.2006 13:53
Re: The algo is easy, but the idea is not quite...(-)
Послано
svr 17 окт 2006 14:08
If we have optimal matrix to take answer is very simple problem. We use double loop, calculate sums A[i,j]+A[i-1,j] and A[i,j-1]+A[i,j] and renew record value searching max.
Idea is very easy for this problem!
First number is always : (n - 1).
Second if n even => 3 * ((n - 2) / 2) + 1
If n odd => 3 * ((n - 1) / 2)
Yes, idea is realy very easy!
Yes, I have also maden by this way. My program is in 7 lines(without var,begin,end - 3).
But I don'y understand why it works in 0.015, except 0.001.
I used only 1 read and if.
strange isn't it?
Re: Idea is very easy for this problem!
Послано
Temp 24 фев 2008 13:21
what is answer if n=8
when only one match with win&lose ,and other is draw
answer should be 6 9 (6(1)+3)?
Edited by author 24.02.2008 13:21
Edited by author 24.02.2008 13:21