Cody

Solution 1965398

Submitted on 7 Oct 2019 by Augusto Mazzei
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
assessFunctionAbsence({'regexp','regexpi','regexprep','str2num'},'FileName','counter.m')

2   Pass
f = counter(0,1); assert(isequal(f(),0)) assert(isequal(f(),1)) assert(isequal(2,f())) assert(isequal(3,f()))

n = 0 a = 0 n = 1 a = 1 n = 2 a = 2 n = 3 a = 3

3   Pass
f = counter(1,0); assert(isequal(f(),1)) assert(isequal(f(),1)) assert(isequal(1,f())) assert(isequal(1,f()))

n = 1 a = 1 n = 1 a = 1 n = 1 a = 1 n = 1 a = 1

4   Pass
f = counter(10,2); assert(isequal(f(),10)) assert(isequal(f(),12)) assert(isequal(14,f())) assert(isequal(16,f()))

n = 10 a = 10 n = 12 a = 12 n = 14 a = 14 n = 16 a = 16

5   Pass
f = counter(0,5); y_correct = [0, 5, 10, 15, 20, 55]; assert(isequal([f() f() f() f() f() f()+f()],y_correct))

n = 0 a = 0 n = 5 a = 5 n = 10 a = 10 n = 15 a = 15 n = 20 a = 20 n = 25 a = 25 n = 30 a = 30

6   Pass
x0 = randi(10); b = randi(10); f = counter(x0,b); y_correct = x0 + (0:1000)*b; assert(isequal(arrayfun(@(n)f(),0:1000),y_correct))

n = 6 a = 6 n = 14 a = 14 n = 22 a = 22 n = 30 a = 30 n = 38 a = 38 n = 46 a = 46 n = 54 a = 54 n = 62 a = 62 n = 70 a = 70 n = 78 a = 78 n = 86 a = 86 n = 94 a = 94 n = 102 a = 102 n = 110 a = 110 n = 118 a = 118 n = 126 a = 126 n = 134 a = 134 n = 142 a = 142 n = 150 a = 150 n = 158 a = 158 n = 166 a = 166 n = 174 a = 174 n = 182 a = 182 n = 190 a = 190 n = 198 a = 198 n = 206 a = 206 n = 214 a = 214 n = 222 a = 222 n = 230 a = 230 n = 238 a = 238 n = 246 a = 246 n = 254 a = 254 n = 262 a = 262 n = 270 a = 270 n = 278 a = 278 n = 286 a = 286 n = 294 a = 294 n = 302 a = 302 n = 310 a = 310 n = 318 a = 318 n = 326 a = 326 n = 334 a = 334 n = 342 a = 342 n = 350 a = 350 n = 358 a = 358 n = 366 a = 366 n = 374 a = 374 n = 382 a = 382 n = 390 a = 390 n = 398 a = 398 n = 406 a = 406 n = 414 a = 414 n = 422 a = 422 n = 430 a = 430 n = 438 a = 438 n = 446 a = 446 n = 454 a = 454 n = 462 a = 462 n = 470 a = 470 n = 478 a = 478 n = 486 a = 486 n = 494 a = 494 n = 502 a = 502 n = 510 a = 510 n = 518 a = 518 n = 526 a = 526 n = 534 a = 534 n = 542 a = 542 n = 550 a = 550 n = 558 a = 558 n = 566 a = 566 n = 574 a = 574 n = 582 a = 582 n = 590 a = 590 n = 598 a = 598 n = 606 a = 606 n = 614 a = 614 n = 622 a = 622 n = 630 a = 630 n = 638 a = 638 n = 646 a = 646 n = 654 a = 654 n = 662 a = 662 n = 670 a = 670 n = 678 a = 678 n = 686 a = 686 n = 694 a = 694 n = 702 a = 702 n = 710 a = 710 n = 718 a = 718 n = 726 a = 726 n = 734 a = 734 n = 742 a = 742 n = 750 a = 750 n = 758 a = 758 n = 766 a = 766 n = 774 a = 774 n = 782 a = 782 n = 790 a = 790 n = 798 a = 798 n = 806 a = 806 n = 814 a = 814 n = 822 a = 822 n = 830 a = 830 n = 838 a = 838 n = 846 a = 846 n = 854 a = 854 n = 862 a = 862 n = 870 a = 870 n = 878 a = 878 n = 886 a = 886 n = 894 a = 894 n = 902 a = 902 n = 910 a = 910 n = 918 a = 918 n = 926 a = 926 n = 934 a = 934 n = 942 a = 942 n = 950 a = 950 n = 958 a = 958 n = 966 a = 966 n = 974 a = 974 n = 982 a = 982 n = 990 a = 990 n = 998 a = 998 n = 1006 a = 1006 n = 1014 a = 1014 n = 1022 a = 1022 n = 1030 a = 1030 n = 1038 a = 1038 n = 1046 a = 1046 n = 1054 a = 1054 n = 1062 a = 1062 n = 1070 a = 1070 n = 1078 a = 1078 n = 1086 a = 1086 n = 1094 a = 1094 n = 1102 a = 1102 n = 1110 a = 1110 n = 1118 a = 1118 n = 1126 a = 1126 n = 1134 a = 1134 n = 1142 a = 1142 n = 1150 a = 1150 n = 1158 a = 1158 n = 1166 a = 1166 n = 1174 a = 1174 n = 1182 a = 1182 n = 1190 a = 1190 n = 1198 a = 1198 n = 1206 a = 1206 n = 1214 a = 1214 n = 1222 a = 1222 n = 1230 a = 1230 n = 1238 a = 1238 n = 1246 a = 1246 n = 1254 a = 1254 n = 1262 a = 1262 n = 1270 a = 1270 n = 1278 a = 1278 n = 1286 a = 1286 n = 1294 a = 1294 n = 1302 a = 1302 n = 1310 a = 1310 n = 1318 a = 1318 n = 1326 a = 1326 n = 1334 a = 1334 n = 1342 a = 1342 n = 1350 a = 1350 n = 1358 a = 1358 n = 1366 a = 1366 n = 1374 a = 1374 n = 1382 a = 1382 n = 1390 a = 1390 n = 1398 a = 1398 n = 1406 a = 1406 n = 1414 a = 1414 n = 1422 a = 1422 n = 1430 a = 1430 n = 1438 a = 1438 n = 1446 a = 1446 n = 1454 a = 1454 n = 1462 a = 1462 n = 1470 a = 1470 n = 1478 a = 1478 n = 1486 a = 1486 n = 1494 a = 1494 n = 1502 a = 1502 n = 1510 a = 1510 n = 1518 a = 1518 n = 1526 a = 1526 n = 1534 a = 1534 n = 1542 a = 1542 n = 1550 a = 1550 n = 1558 a = 1558 n = 1566 a = 1566 n = 1574 a = 1574 n = 1582 a = 1582 n = 1590 a = 1590 n = 1598 a = 1598 n = 1606 a = 1606 n = 1614 a = 1614 n = 1622 a = 1622 n = 1630 a = 1630 n = 1638 a = 1638 n = 1646 a = 1646 n = 1654 a = 1654 n = 1662 a = 1662 n = 1670 a = 1670 n = 1678 a = 1678 n = 1686 a = 1686 n = 1694 a = 1694 n = 1702 a = 1702 n = 1710 a = 1710 n = 1718 a = 1718 n = 1726 a = 1726 n = 1734 a = 1734 n = 1742 a = 1742 n = 1750 a = 1750 n = 1758 a = 1758 n = 1766 a = 1766 n = 1774 a = 1774 n = 1782 a = 1782 n = 1790 a = 1790 n = 1798 a = 1798 n = 1806 a = 1806 n = 1814 a = 1814 n = 1822 a = 1822 n = 1830 a = 1830 n = 1838 a = 1838 n = 1846 a = 1846 n = 1854 a = 1854 n = 1862 a = 1862 n = 1870 a = 1870 n = 1878 a = 1878 n = 1886 a = 1886 n = 1894 a = 1894 n = 1902 a = 1902 n = 1910 a = 1910 n = 1918 a = 1918 n = 1926 a = 1926 n = 1934 a = 1934 n = 1942 a = 1942 n = 1950 a = 1950 n = 1958 a = 1958 n = 1966 a = 1966 n = 1974 a = 1974 n = 1982 a = 1982 n = 1990 a = 1990 n = 1998 a = 1998 n = 2006 a = 2006 n = 2014 a = 2014 n = 2022 a = 2022 n = 2030 a = 2030 n = 2038 a = 2038 n = 2046 a = 2046 n = 2054 a = 2054 n = 2062 a = 2062 n = 2070 a = 2070 n = 2078 a = 2078 n = 2086 a = 2086 n = 2094 a = 2094 n = 2102 a = 2102 n = 2110 a = 2110 n = 2118 a = 2118 n = 2126 a = 2126 n = 2134 a = 2134 n = 2142 a = 2142 n = 2150 a = 2150 n = 2158 a = 2158 n = 2166 a = 2166 n = 2174 a = 2174 n = 2182 a = 2182 n = 2190 a = 2190 n = 2198 a = 2198 n = 2206 a = 2206 n = 2214 a = 2214 n = 2222 a = 2222 n = 2230 a = 2230 n = 2238 a = 2238 n = 2246 a = 2246 n = 2254 a = 2254 n = 2262 a = 2262 n = 2270 a = 2270 n = 2278 a = 2278 n = 2286 a = 2286 n = 2294 a = 2294 n = 2302 ...