Cody

# Problem 136. Read a Soroban Abacus

Solution 2089503

Submitted on 12 Jan 2020 by Asif Newaz
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 = [ 1 0 1 1 0 1 1 ]'; y_correct = 2; assert(isequal(soroban_evaluate(x),y_correct))

s = 0 0 1 1 0 1 1 s = 0 0 1 1 0 0 0 s = 0 0 1 1 0 0 0 s = 0 0 1 1 0 0 0 y = 2

2   Pass
x = [ 1 1 0 0 0 0 0 1 1 1 1 0 0 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 ]; y_correct = 10586; assert(isequal(soroban_evaluate(x),y_correct))

s = 0 0 0 0 0 0 0 5 5 5 1 0 0 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 s = 0 0 0 0 0 0 0 5 5 5 1 0 0 1 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 s = 0 0 0 0 0 0 0 5 5 5 1 0 0 1 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 s = 0 0 0 0 0 0 0 5 50 5 1 0 0 10 1 0 0 0 10 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 s = 0 0 0 0 0 0 0 500 50 5 1 0 0 10 1 0 0 0 10 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 s = 0 0 0 0 0 0 0 500 50 5 1 0 0 10 1 0 0 0 10 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 s = 0 0 0 0 0 0 0 500 50 5 10000 0 0 10 1 0 0 0 10 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 s = 0 0 0 0 0 0 0 500 50 5 10000 0 0 10 1 0 0 0 10 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 y = 10586

3   Pass
x = [ 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1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 1 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 s = 0 0 0 0 0 0 0 0 0 0 5 5 5 5 5 0 0 0 0 0 1 1 1 1 0 1 1 100 10 0 1 1 1 0 0 1 1 100 0 0 1 1 0 0 0 1 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 s = 0 0 0 0 0 0 0 0 0 0 5 5 5 5 5 0 0 0 0 0 1 1 1 1 0 1 1000 100 10 0 1 1 1 0 0 1 1000 100 0 0 1 1 0 0 0 1 1000 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 s = 0 0 0 0 0 0 0 0 0 0 5 5 5 5 5 0 0 0 0 0 1 1 1 1 0 10000 1000 100 10 0 1 1 1 0 0 10000 1000 100 0 0 1 1 0 0 0 10000 1000 0 0 0 1 0 0 0 0 10000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 s = 0 0 0 0 0 0 0 0 0 0 5 5 5 5 500000 0 0 0 0 0 1 1 1 1 0 10000 1000 100 10 0 1 1 1 0 0 10000 1000 100 0 0 1 1 0 0 0 10000 1000 0 0 0 1 0 0 0 0 10000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 s = 0 0 0 0 0 0 0 0 0 0 5 5 5 5000000 500000 0 0 0 0 0 1 1 1 1000000 0 10000 1000 100 10 0 1 1 1 0 0 10000 1000 100 0 0 1 1 0 0 0 10000 1000 0 0 0 1 0 0 0 0 10000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 s = 0 0 0 0 0 0 0 0 0 0 5 5 50000000 5000000 500000 0 0 0 0 0 1 1 10000000 1000000 0 10000 1000 100 10 0 1 1 10000000 0 0 10000 1000 100 0 0 1 1 0 0 0 10000 1000 0 0 0 1 0 0 0 0 10000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 s = 0 0 0 0 0 0 0 0 0 0 5 500000000 50000000 5000000 500000 0 0 0 0 0 1 100000000 10000000 1000000 0 10000 1000 100 10 0 1 100000000 10000000 0 0 10000 1000 100 0 0 1 100000000 0 0 0 10000 1000 0 0 0 1 0 0 0 0 10000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 s = 1.0e+09 * 0 0 0 0 0 0 0 0 0 0 5.0000 0.5000 0.0500 0.0050 0.0005 0 0 0 0 0 1.0000 0.1000 0.0100 0.0010 0 0.0000 0.0000 0.0000 0.0000 0 1.0000 0.1000 0.0100 0 0 0.0000 0.0000 0.0000 0 0 1.0000 0.1000 0 0 0 0.0000 0.0000 0 0 0 1.0000 0 0 0 0 0.0000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 s = 1.0e+09 * 0 0 0 0 0 0 0 0 0 0 5.0000 0.5000 0.0500 0.0050 0.0005 0 0 0 0 0 1.0000 0.1000 0.0100 0.0010 0 0.0000 0.0000 0.0000 0.0000 0 1.0000 0.1000 0.0100 0 0 0.0000 0.0000 0.0000 0 0 1.0000 0.1000 0 0 0 0.0000 0.0000 0 0 0 1.0000 0 0 0 0 0.0000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 y = 9.8765e+09

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!