Cody

# Problem 3019. Calculator spelling - Letters to Numbers

Solution 2728443

Submitted on 22 Jul 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
n = 35007; word = 'LOOSE'; assert(isequal(calc_spell_num(word),n))

z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 7 y = 7 z = logical 1 z1 = 0 y = 7 z = logical 1 z1 = 0 y = 7 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 5000 y = 5007 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 30000 y = 35007

2   Pass
n = 77345; word = 'ShELL'; assert(isequal(calc_spell_num(word),n))

z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 5 y = 5 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 40 y = 45 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 300 y = 345 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 7000 y = 7345 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 70000 y = 77345

3   Pass
n = 36138; word = 'BEIgE'; assert(isequal(calc_spell_num(word),n))

z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 8 y = 8 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 30 y = 38 z = logical 0 z = logical 1 z1 = 100 y = 138 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 6000 y = 6138 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 30000 y = 36138

4   Pass
n = 378806; word = 'gOBBLE'; assert(isequal(calc_spell_num(word),n))

z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 6 y = 6 z = logical 1 z1 = 0 y = 6 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 800 y = 806 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 8000 y = 8806 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 70000 y = 78806 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 300000 y = 378806

5   Pass
n = 376006; word = 'gOOgLE'; assert(isequal(calc_spell_num(word),n))

z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 6 y = 6 z = logical 1 z1 = 0 y = 6 z = logical 1 z1 = 0 y = 6 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 6000 y = 6006 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 70000 y = 76006 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 300000 y = 376006

6   Pass
n = 57738461375; word = 'SLEIghBELLS'; assert(isequal(calc_spell_num(word),n))

z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 5 y = 5 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 70 y = 75 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 300 y = 375 z = logical 0 z = logical 1 z1 = 1000 y = 1375 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 60000 y = 61375 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 400000 y = 461375 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 8000000 y = 8461375 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 30000000 y = 38461375 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 700000000 y = 738461375 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 7.0000e+09 y = 7.7385e+09 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 5.0000e+10 y = 5.7738e+10

7   Fail
n = 0.7734; word = 'hELLO'; assert(isequal(calc_spell_num(word),n))

z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 4 y = 4 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 30 y = 34 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 700 y = 734 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 7000 y = 7734 z = logical 1 z1 = 0 y = 7734

Assertion failed.

8   Pass
n = 53045; word = 'ShOES'; assert(isequal(calc_spell_num(word),n))

z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 5 y = 5 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 40 y = 45 z = logical 1 z1 = 0 y = 45 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 3000 y = 3045 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 50000 y = 53045

9   Pass
n = 771; word = 'ILL'; assert(isequal(calc_spell_num(word),n))

z = logical 0 z = logical 1 z1 = 1 y = 1 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 70 y = 71 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 700 y = 771

10   Pass
n = 345; word = 'ShE'; assert(isequal(calc_spell_num(word),n))

z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 5 y = 5 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 40 y = 45 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 300 y = 345

11   Pass
n = 7735; word = 'SELL'; assert(isequal(calc_spell_num(word),n))

z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 5 y = 5 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 30 y = 35 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 700 y = 735 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 7000 y = 7735

12   Pass
ind = randi(4); n_arr = [36138 707 7714 57738]; n = n_arr(ind); word_arr = {'BEIgE','LOL','hILL','BELLS'}; word = word_arr{ind}; assert(isequal(calc_spell_num(word),n))

z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 8 y = 8 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 30 y = 38 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 700 y = 738 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 7000 y = 7738 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 0 z = logical 1 z1 = 50000 y = 57738

### Community Treasure Hunt

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

Start Hunting!