|
|
вернуться в форумPlease tell me how to prove! Послано PSV 23 окт 2006 23:14 I've AC but I can't undestand how prove that GCD gives right answer? Re: Please tell me how to prove! Послано PSV 26 окт 2006 21:12 Come ON! Please I want to know Re: Please tell me how to prove! Every stone may go to positions pos+K*x, pos - its original place, x - some integer, K - sought value. If for every stone its designated position is reachable (i.e. K divides abs(dst-src)), then stones are sortable - just bubble-sort each of K chains, and they are not sortable otherwise. So, the answer is GCD(dst-src) for all stones. Edited by author 06.08.2008 16:12 |
|
|