Cody

# Problem 1174. Wheat on a chessboard pt 2

Solution 2183189

Submitted on 30 Mar 2020 by Ethan Allan
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))

A = 0 A = 56 temp = 56

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

A = 0 A = 1 temp = 1 temp = 2 A = 3 temp = 4 A = 7 temp = 8 A = 15 temp = 16 A = 31 temp = 32 A = 63 temp = 64 A = 127 temp = 128 A = 255 temp = 256 A = 511 temp = 512 A = 1023 temp = 1024 A = 2047 temp = 2048 A = 4095 temp = 4096 A = 8191 temp = 8192 A = 16383 temp = 16384 A = 32767 temp = 32768 A = 65535 temp = 65536 A = 131071 temp = 131072 A = 262143 temp = 262144 A = 524287 temp = 524288 A = 1048575 temp = 1048576 A = 2097151 temp = 2097152 A = 4194303 temp = 4194304 A = 8388607 temp = 8388608 A = 16777215 temp = 16777216 A = 33554431 temp = 33554432 A = 67108863 temp = 67108864 A = 134217727 temp = 134217728 A = 268435455 temp = 268435456 A = 536870911 temp = 536870912 A = 1.0737e+09 temp = 1.0737e+09 A = 2.1475e+09 temp = 2.1475e+09 A = 4.2950e+09 temp = 4.2950e+09 A = 8.5899e+09 temp = 8.5899e+09 A = 1.7180e+10 temp = 1.7180e+10 A = 3.4360e+10 temp = 3.4360e+10 A = 6.8719e+10 temp = 6.8719e+10 A = 1.3744e+11 temp = 1.3744e+11 A = 2.7488e+11 temp = 2.7488e+11 A = 5.4976e+11 temp = 5.4976e+11 A = 1.0995e+12 temp = 1.0995e+12 A = 2.1990e+12 temp = 2.1990e+12 A = 4.3980e+12 temp = 4.3980e+12 A = 8.7961e+12 temp = 8.7961e+12 A = 1.7592e+13 temp = 1.7592e+13 A = 3.5184e+13 temp = 3.5184e+13 A = 7.0369e+13 temp = 7.0369e+13 A = 1.4074e+14 temp = 1.4074e+14 A = 2.8147e+14 temp = 2.8147e+14 A = 5.6295e+14 temp = 5.6295e+14 A = 1.1259e+15 temp = 1.1259e+15 A = 2.2518e+15 temp = 2.2518e+15 A = 4.5036e+15 temp = 4.5036e+15 A = 9.0072e+15 temp = 9.0072e+15 A = 1.8014e+16 temp = 1.8014e+16 A = 3.6029e+16 temp = 3.6029e+16 A = 7.2058e+16 temp = 7.2058e+16 A = 1.4412e+17 temp = 1.4412e+17 A = 2.8823e+17 temp = 2.8823e+17 A = 5.7646e+17 temp = 5.7646e+17 A = 1.1529e+18 temp = 1.1529e+18 A = 2.3058e+18 temp = 2.3058e+18 A = 4.6117e+18 temp = 4.6117e+18 A = 9.2234e+18 temp = 9.2234e+18 A = 1.8447e+19

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

A = 0 A = -1 temp = -1 temp = -2 A = -3 temp = -4 A = -7 temp = -8 A = -15 temp = -16 A = -31 temp = -32 A = -63 temp = -64 A = -127 temp = -128 A = -255 temp = -256 A = -511 temp = -512 A = -1023 temp = -1024 A = -2047 temp = -2048 A = -4095 temp = -4096 A = -8191 temp = -8192 A = -16383 temp = -16384 A = -32767 temp = -32768 A = -65535 temp = -65536 A = -131071 temp = -131072 A = -262143 temp = -262144 A = -524287 temp = -524288 A = -1048575 temp = -1048576 A = -2097151 temp = -2097152 A = -4194303 temp = -4194304 A = -8388607 temp = -8388608 A = -16777215 temp = -16777216 A = -33554431 temp = -33554432 A = -67108863 temp = -67108864 A = -134217727 temp = -134217728 A = -268435455 temp = -268435456 A = -536870911 temp = -536870912 A = -1.0737e+09 temp = -1.0737e+09 A = -2.1475e+09 temp = -2.1475e+09 A = -4.2950e+09 temp = -4.2950e+09 A = -8.5899e+09 temp = -8.5899e+09 A = -1.7180e+10 temp = -1.7180e+10 A = -3.4360e+10 temp = -3.4360e+10 A = -6.8719e+10 temp = -6.8719e+10 A = -1.3744e+11 temp = -1.3744e+11 A = -2.7488e+11 temp = -2.7488e+11 A = -5.4976e+11 temp = -5.4976e+11 A = -1.0995e+12 temp = -1.0995e+12 A = -2.1990e+12 temp = -2.1990e+12 A = -4.3980e+12 temp = -4.3980e+12 A = -8.7961e+12 temp = -8.7961e+12 A = -1.7592e+13 temp = -1.7592e+13 A = -3.5184e+13 temp = -3.5184e+13 A = -7.0369e+13 temp = -7.0369e+13 A = -1.4074e+14 temp = -1.4074e+14 A = -2.8147e+14 temp = -2.8147e+14 A = -5.6295e+14 temp = -5.6295e+14 A = -1.1259e+15 temp = -1.1259e+15 A = -2.2518e+15 temp = -2.2518e+15 A = -4.5036e+15 temp = -4.5036e+15 A = -9.0072e+15 temp = -9.0072e+15 A = -1.8014e+16 temp = -1.8014e+16 A = -3.6029e+16 temp = -3.6029e+16 A = -7.2058e+16 temp = -7.2058e+16 A = -1.4412e+17 temp = -1.4412e+17 A = -2.8823e+17 temp = -2.8823e+17 A = -5.7646e+17 temp = -5.7646e+17 A = -1.1529e+18 temp = -1.1529e+18 A = -2.3058e+18 temp = -2.3058e+18 A = -4.6117e+18 temp = -4.6117e+18 A = -9.2234e+18 temp = -9.2234e+18 A = -1.8447e+19

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

A = 0 A = 5 temp = 5 temp = 15 A = 20 temp = 45 A = 65 temp = 135 A = 200

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

A = 0 A = 10 temp = 10 temp = -50 A = -40 temp = 250 A = 210 temp = -1250 A = -1040 temp = 6250 A = 5210 temp = -31250 A = -26040 temp = 156250 A = 130210 temp = -781250 A = -651040 temp = 3906250 A = 3255210

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

A = 0 A = 1 temp = 1

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

A = 0 A = "NaN"

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

A = 0 A = 12 temp = 12 temp = 12 A = 24 temp = 12 A = 36 temp = 12 A = 48 temp = 12 A = 60 temp = 12 A = 72 temp = 12 A = 84 temp = 12 A = 96 temp = 12 A = 108