Cody

# Problem 1174. Wheat on a chessboard pt 2

Solution 2262486

Submitted on 7 May 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status 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   Fail
x = 1; y = 2; n = 8; A_correct = 18446744073709551615; assert(isequal(wheat_chess(x,y,n),A_correct))

A = 3 A = 9 A = 27 A = 81 A = 243 A = 729 A = 2187 A = 6561 A = 19683 A = 59049 A = 177147 A = 531441 A = 1594323 A = 4782969 A = 14348907 A = 43046721 A = 129140163 A = 387420489 A = 1.1623e+09 A = 3.4868e+09 A = 1.0460e+10 A = 3.1381e+10 A = 9.4143e+10 A = 2.8243e+11 A = 8.4729e+11 A = 2.5419e+12 A = 7.6256e+12 A = 2.2877e+13 A = 6.8630e+13 A = 2.0589e+14 A = 6.1767e+14 A = 1.8530e+15 A = 5.5591e+15 A = 1.6677e+16 A = 5.0032e+16 A = 1.5009e+17 A = 4.5028e+17 A = 1.3509e+18 A = 4.0526e+18 A = 1.2158e+19 A = 3.6473e+19 A = 1.0942e+20 A = 3.2826e+20 A = 9.8477e+20 A = 2.9543e+21 A = 8.8629e+21 A = 2.6589e+22 A = 7.9766e+22 A = 2.3930e+23 A = 7.1790e+23 A = 2.1537e+24 A = 6.4611e+24 A = 1.9383e+25 A = 5.8150e+25 A = 1.7445e+26 A = 5.2335e+26 A = 1.5700e+27 A = 4.7101e+27 A = 1.4130e+28 A = 4.2391e+28 A = 1.2717e+29 A = 3.8152e+29 A = 1.1446e+30

Assertion failed.

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

A = -3 A = -9 A = -27 A = -81 A = -243 A = -729 A = -2187 A = -6561 A = -19683 A = -59049 A = -177147 A = -531441 A = -1594323 A = -4782969 A = -14348907 A = -43046721 A = -129140163 A = -387420489 A = -1.1623e+09 A = -3.4868e+09 A = -1.0460e+10 A = -3.1381e+10 A = -9.4143e+10 A = -2.8243e+11 A = -8.4729e+11 A = -2.5419e+12 A = -7.6256e+12 A = -2.2877e+13 A = -6.8630e+13 A = -2.0589e+14 A = -6.1767e+14 A = -1.8530e+15 A = -5.5591e+15 A = -1.6677e+16 A = -5.0032e+16 A = -1.5009e+17 A = -4.5028e+17 A = -1.3509e+18 A = -4.0526e+18 A = -1.2158e+19 A = -3.6473e+19 A = -1.0942e+20 A = -3.2826e+20 A = -9.8477e+20 A = -2.9543e+21 A = -8.8629e+21 A = -2.6589e+22 A = -7.9766e+22 A = -2.3930e+23 A = -7.1790e+23 A = -2.1537e+24 A = -6.4611e+24 A = -1.9383e+25 A = -5.8150e+25 A = -1.7445e+26 A = -5.2335e+26 A = -1.5700e+27 A = -4.7101e+27 A = -1.4130e+28 A = -4.2391e+28 A = -1.2717e+29 A = -3.8152e+29 A = -1.1446e+30

Assertion failed.

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

A = 20 A = 80 A = 320

Assertion failed.

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

A = -40 A = 160 A = -640 A = 2560 A = -10240 A = 40960 A = -163840 A = 655360

Assertion failed.

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

7   Fail
x = 1; y = 0; n = -1; A_correct = 'NaN'; assert(isequal(wheat_chess(x,y,n),A_correct))

Assertion failed.

8   Fail
x = 12; y = 1; n = 3; A_correct = 108; assert(isequal(wheat_chess(x,y,n),A_correct))

A = 24 A = 48 A = 96 A = 192 A = 384 A = 768 A = 1536 A = 3072

Assertion failed.