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 186217

Submitted on 4 Jan 2013 by Robert Turner

Correct

58Size
Leading solution size is 26.
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
 
%%
x = 56;
y = 1;
n = 1;
A_correct = 56;
assert(isequal(wheat_chess(x,y,n),A_correct))

                    
2
Pass
 
%%
x = 1;
y = 2;
n = 8;
A_correct = 18446744073709551615;
assert(isequal(wheat_chess(x,y,n),A_correct))

                    
3
Pass
 
%%
x = -1;
y = 2;
n = 8;
A_correct = -18446744073709551615;
assert(isequal(wheat_chess(x,y,n),A_correct))

                    
4
Pass
 
%%
x = 5;
y = 3;
n = 2;
A_correct = 200;
assert(isequal(wheat_chess(x,y,n),A_correct))

                    
5
Pass
 
%%
x = 10;
y = -5;
n = 3;
A_correct = 3255210;
assert(isequal(wheat_chess(x,y,n),A_correct))

                    
6
Pass
 
%%
x = 1;
y = 0;
n = 1;
A_correct = 1;
assert(isequal(wheat_chess(x,y,n),A_correct))

                    
7
Pass
 
%%
x = 1;
y = 0;
n = -1;
A_correct = 'NaN';
assert(isequal(wheat_chess(x,y,n),A_correct))
A =
NaN
8
Pass
 
%%
x = 12;
y = 1;
n = 3;
A_correct = 108;
assert(isequal(wheat_chess(x,y,n),A_correct))