Cody

Solution 1854451

Submitted on 20 Jun 2019 by ME
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
y_correct = 10234; x = '10000+200+30+4'; assert(isequal(contracted_form(x),y_correct))

idx = 0 6 10 13 15 y = 10000 y = 10200 y = 10230 y = 10234 y = 10234

2   Pass
y_correct = 987654321; x='900000000+80000000+7000000+600000+50000+4000+300+20+1'; assert(isequal(contracted_form(x),y_correct))

idx = 0 10 19 27 34 40 45 49 52 54 y = 900000000 y = 980000000 y = 987000000 y = 987600000 y = 987650000 y = 987654000 y = 987654300 y = 987654320 y = 987654321 y = 987654321

3   Pass
y_correct = 1000; x = '1000'; assert(isequal(contracted_form(x),y_correct))

idx = 0 5 y = 1000 y = 1000

4   Pass
y_correct = 314159265358979; x = '300000000000000+10000000000000+4000000000000+100000000000+50000000000+9000000000+200000000+60000000+5000000+300000+50000+8000+900+70+9'; assert(isequal(contracted_form(x),y_correct))

idx = 0 16 31 45 58 70 81 91 100 108 115 121 126 130 133 135 y = 3.0000e+14 y = 3.1000e+14 y = 3.1400e+14 y = 3.1410e+14 y = 3.1415e+14 y = 3.1416e+14 y = 3.1416e+14 y = 3.1416e+14 y = 3.1416e+14 y = 3.1416e+14 y = 3.1416e+14 y = 3.1416e+14 y = 3.1416e+14 y = 3.1416e+14 y = 3.1416e+14 y = 3.1416e+14

5   Pass
y_correct = 540200; x='500000+40000+200'; assert(isequal(contracted_form(x),y_correct))

idx = 0 7 13 17 y = 500000 y = 540000 y = 540200 y = 540200