Cody

Solution 1698852

Submitted on 23 Dec 2018
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 = 6; N = 3; y = buildSumArray(x,N); y2 = unique(y); assert(isequal(round(sum(y)*100)/100,x)) assert(isequal(length(y),N)) assert(isequal(length(y2),N)) assert(sum(y == 0) == 0) assert(isempty(y(y < 0)))

y = 1 2 y = 0.8877 1.8877 y = 0.8877 1.8877 3.2246

2   Pass
x = 13; N = 5; y = buildSumArray(x,N); y2 = unique(y); assert(isequal(round(sum(y)*100)/100,x)) assert(isequal(length(y),N)) assert(isequal(length(y2),N)) assert(sum(y == 0) == 0) assert(isempty(y(y < 0)))

y = 1 2 3 4 y = 0.8877 1.8877 2.8877 3.8877 y = 0.8877 1.8877 2.8877 3.8877 3.4492

3   Pass
x = 78; N = 11; y = buildSumArray(x,N); y2 = unique(y); assert(isequal(round(sum(y)*100)/100,x)) assert(isequal(length(y),N)) assert(isequal(length(y2),N)) assert(sum(y == 0) == 0) assert(isempty(y(y < 0)))

y = 1 2 3 4 5 6 7 8 9 10 y = 0.8877 1.8877 2.8877 3.8877 4.8877 5.8877 6.8877 7.8877 8.8877 9.8877 y = 0.8877 1.8877 2.8877 3.8877 4.8877 5.8877 6.8877 7.8877 8.8877 9.8877 24.1230

4   Fail
x = 2689; N = 245; y = buildSumArray(x,N); y2 = unique(y); assert(isequal(round(sum(y)*100)/100,x)) assert(isequal(length(y),N)) assert(isequal(length(y2),N)) assert(sum(y == 0) == 0) assert(isempty(y(y < 0)))

y = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 60 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 Columns 61 through 90 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 Columns 91 through 120 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 Columns 121 through 150 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 Columns 151 through 180 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 Columns 181 through 210 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 Columns 211 through 240 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 Columns 241 through 244 241 242 243 244 y = Columns 1 through 18 0.8877 1.8877 2.8877 3.8877 4.8877 5.8877 6.8877 7.8877 8.8877 9.8877 10.8877 11.8877 12.8877 13.8877 14.8877 15.8877 16.8877 17.8877 Columns 19 through 36 18.8877 19.8877 20.8877 21.8877 22.8877 23.8877 24.8877 25.8877 26.8877 27.8877 28.8877 29.8877 30.8877 31.8877 32.8877 33.8877 34.8877 35.8877 Columns 37 through 54 36.8877 37.8877 38.8877 39.8877 40.8877 41.8877 42.8877 43.8877 44.8877 45.8877 46.8877 47.8877 48.8877 49.8877 50.8877 51.8877 52.8877 53.8877 Columns 55 through 72 54.8877 55.8877 56.8877 57.8877 58.8877 59.8877 60.8877 61.8877 62.8877 63.8877 64.8877 65.8877 66.8877 67.8877 68.8877 69.8877 70.8877 71.8877 Columns 73 through 90 72.8877 73.8877 74.8877 75.8877 76.8877 77.8877 78.8877 79.8877 80.8877 81.8877 82.8877 83.8877 84.8877 85.8877 86.8877 87.8877 88.8877 89.8877 Columns 91 through 108 90.8877 91.8877 92.8877 93.8877 94.8877 95.8877 96.8877 97.8877 98.8877 99.8877 100.8877 101.8877 102.8877 103.8877 104.8877 105.8877 106.8877 107.8877 Columns 109 through 126 108.8877 109.8877 110.8877 111.8877 112.8877 113.8877 114.8877 115.8877 116.8877 117.8877 118.8877 119.8877 120.8877 121.8877 122.8877 123.8877 124.8877 125.8877 Columns 127 through 144 126.8877 127.8877 128.8877 129.8877 130.8877 131.8877 132.8877 133.8877 134.8877 135.8877 136.8877 137.8877 138.8877 139.8877 140.8877 141.8877 142.8877 143.8877 Columns 145 through 162 144.8877 145.8877 146.8877 147.8877 148.8877 149.8877 150.8877 151.8877 152.8877 153.8877 154.8877 155.8877 156.8877 157.8877 158.8877 159.8877 160.8877 161.8877 Columns 163 through 180 162.8877 163.8877 164.8877 165.8877 166.8877 167.8877 168.8877 169.8877 170.8877 171.8877 172.8877 173.8877 174.8877 175.8877 176.8877 177.8877 178.8877 179.8877 Columns 181 through 198 180.8877 181.8877 182.8877 183.8877 184.8877 185.8877 186.8877 187.8877 188.8877 189.8877 190.8877 191.8877 192.8877 193.8877 194.8877 195.8877 196.8877 197.8877 Columns 199 through 216 198.8877 199.8877 200.8877 201.8877 202.8877 203.8877 204.8877 205.8877 206.8877 207.8877 208.8877 209.8877 210.8877 211.8877 212.8877 213.8877 214.8877 215.8877 Columns 217 through 234 216.8877 217.8877 218.8877 219.8877 220.8877 221.8877 222.8877 223.8877 224.8877 225.8877 226.8877 227.8877 228.8877 229.8877 230.8877 231.8877 232.8877 233.8877 Columns 235 through 244 234.8877 235.8877 236.8877 237.8877 238.8877 239.8877 240.8877 241.8877 242.8877 243.8877 y = 1.0e+04 * Columns 1 through 18 0.0001 0.0002 0.0003 0.0004 0.0005 0.0006 0.0007 0.0008 0.0009 0.0010 0.0011 0.0012 0.0013 0.0014 0.0015 0.0016 0.0017 0.0018 Columns 19 through 36 0.0019 0.0020 0.0021 0.0022 0.0023 0.0024 0.0025 0.0026 0.0027 0.0028 0.0029 0.0030 0.0031 0.0032 0.0033 0.0034 0.0035 0.0036 Columns 37 through 54 0.0037 0.0038 0.0039 0.0040 0.0041 0.0042 0.0043 0.0044 0.0045 0.0046 0.0047 0.0048 0.0049 0.0050 0.0051 0.0052 0.0053 0.0054 Columns 55 through 72 0.0055 0.0056 0.0057 0.0058 0.0059 0.0060 0.0061 0.0062 0.0063 0.0064 0.0065 0.0066 0.0067 0.0068 0.0069 0.0070 0.0071 0.0072 Columns 73 through 90 0.0073 0.0074 0.0075 0.0076 0.0077 0.0078 0.0079 0.0080 0.0081 0.0082 0.0083 0.0084 0.0085 0.0086 0.0087 0.0088 0.0089 0.0090 Columns 91 through 108 0.0091 0.0092 0.0093 0.0094 0.0095 0.0096 0.0097 0.0098 0.0099 0.0100 0.0101 0.0102 0.0103 0.0104 0.0105 0.0106 0.0107 0.0108 Columns 109 through 126 0.0109 0.0110 0.0111 0.0112 0.0113 0.0114 0.0115 0.0116 0.0117 0.0118 0.0119 0.0120 0.0121 0.0122 0.0123 0.0124 0.0125 0.0126 Columns 127 through 144 0.0127 0.0128 0.0129 0.0130 0.0131 0.0132 0.0133 0.0134 0.0135 0.0136 0.0137 0.0138 0.0139 0.0140 0.0141 0.0142 0.0143 0.0144 Columns 145 through 162 0.0145 0.0146 0.0147 0.0148 0.0149 0.0150 0.0151 0.0152 0.0153 0.0154 0.0155 0.0156 0.0157 0.0158 0.0159 0.0160 0.0161 0.0162 Columns 163 through 180 0.0163 0.0164 0.0165 0.0166 0.0167 0.0168 0.0169 0.0170 0.0171 0.0172 0.0173 0.0174 0.0175 0.0176 0.0177 0.0178 0.0179 0.0180 Columns 181 through 198 0.0181 0.0182 0.0183 0.0184 0.0185 0.0186 0.0187 0.0188 0.0189 0.0190 0.0191 0.0192 0.0193 0.0194 0.0195 0.0196 0.0197 0.0198 Columns 199 through 216 0.0199 0.0200 0.0201 0.0202 0.0203 0.0204 0.0205 0.0206 0.0207 0.0208 0.0209 0.0210 0.0211 0.0212 0.0213 0.0214 0.0215 0.0216 Columns 217 through 234 0.0217 0.0218 0.0219 0.0220 0.0221 0.0222 0.0223 0.0224 0.0225 0.0226 0.0227 0.0228 0.0229 0.0230 0.0231 0.0232 0.0233 0.0234 Columns 235 through 245 0.0235 0.0236 0.0237 0.0238 0.0239 0.0240 0.0241 0.0242 0.0243 0.0244 -2.7174

Assertion failed.