Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 266367

Submitted on 24 Jun 2013 by Claudio Gelmi

Correct

64Size
Leading solution size is 35.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
m=[5 1 8;3 9 4;7 2 6];
K=kurchan_score(m) % 486
assert(K==486)
K =
   486
2
Pass
 
%%
m=[1 24	65 80 68 41 54 36 39
49 51 28 14 67 57 77 2 45
37 23 40 42 6 10 81 55 69
74 58 3 30 16 43 32 44 70
29 63 79 60 53 35 27 15 4
52 8 31 62 72 73 5 50 25
33 20 22 46 7 71 56 78 18
61 21 38 9 48 13 19 76 66
64 75 59 12 47 11 17 34 26];
tic
K=uint64(kurchan_score(m)) %  481200422400
toc
assert(K==481200422400)
K =
         481200422400
Elapsed time is 0.001333 seconds.
3
Pass
 
%%
v=[ 1     6     2     9     3     8     4     5     7]; % 366
m=reshape(v,3,[]);
K=uint64(kurchan_score(m))
assert(K==366)
K =
                  366
4
Pass
 
%%
v=[ 8    2    3    7    5    1    9    4    6]; % 486
m=reshape(v,3,[]);
K=uint64(kurchan_score(m))
assert(K==486)
K =
                  486
5
Pass
 
%%
v=[ 9 11 12 7 10 15 5 6 2 14 8 4 3 13 1 16];
m=reshape(v,4,[]); % 29590
K=uint64(kurchan_score(m))
assert(K==29590)
K =
                29590
6
Pass
 
%%
v=[ 1 16 15 6 12 3 2 8 7 9 14 13 10 11 4 5];
m=reshape(v,4,[]); % 11256
K=uint64(kurchan_score(m))
assert(K==11256)
K =
                11256