|
|
вернуться в форумI guessed - can someone explain why? Послано Steve 24 июн 2013 06:37 I got AC on this simply by guessing that combining the stripies from the largest down to the smallest would result in the smallest colony size. Can someone explain what mathematical or logical reasoning would be used to arrive at this conclusion, or prove that this conclusion would be true? Re: I guessed - can someone explain why? I guessed the same and also I want to know mathematical proof Re: I guessed - can someone explain why? The factor 2 does not matter -- you will always find one 2 which was sqrt'ed (n-1) times, ..., one 2 not sqrt'ed. OOH, there will be exactly two given number which got sqrt'ed (n-1) times, ..., one given number that got sqrt'ed once. Therefore, you will want larger numbers be sqrt'ed more times. Edited by author 22.03.2016 12:08 Re: I guessed - can someone explain why? I can explain Okay, we have sequence m1,m2,m3,m4.... of weights in input But now imagine that we have a heap of stripies with their weights. Our answer (for example n=4) will be: 2*sqrt(m1*2*sqrt(m2*2*sqrt(m3*m4))) for greater understanding write it on a sheet. So we need to maximize it but we don't know order of m1,m2,m3,... which give max answer. It's clear that if 2*sqrt(m1*2*sqrt(m2*2*sqrt(m3*m4))) should be maximum then m1*2*sqrt(m2*2*sqrt(m3*m4)) (in sqrt) should be maximum too. Reasoning in this way we understand that we need m3*m4 be maximum. So this sequence should be sorted in this way: m4>=m3>=m2>=m1 I hope my English is enough to explain it)))) Edited by author 31.03.2017 19:50 |
|
|