Cody

Solution 1235721

Submitted on 20 Jul 2017 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
x = 1; y_correct = 1; assert(isequal(nthodious(x),y_correct))

q = 1

2   Pass
x = 2; y_correct = 2; assert(isequal(nthodious(x),y_correct))

q = 1 q = 2

3   Pass
x = 3; y_correct = 4; assert(isequal(nthodious(x),y_correct))

q = 1 q = 2 q = 2 q = 3

4   Pass
x = 9; y_correct = 16; assert(isequal(nthodious(x),y_correct))

q = 1 q = 2 q = 2 q = 3 q = 3 q = 3 q = 4 q = 5 q = 5 q = 5 q = 6 q = 6 q = 7 q = 8 q = 8 q = 9

5   Pass
x = 17; y_correct = 32; assert(isequal(nthodious(x),y_correct))

q = 1 q = 2 q = 2 q = 3 q = 3 q = 3 q = 4 q = 5 q = 5 q = 5 q = 6 q = 6 q = 7 q = 8 q = 8 q = 9 q = 9 q = 9 q = 10 q = 10 q = 11 q = 12 q = 12 q = 12 q = 13 q = 14 q = 14 q = 15 q = 15 q = 15 q = 16 q = 17

6   Pass
x = 33; y_correct = 64; assert(isequal(nthodious(x),y_correct))

q = 1 q = 2 q = 2 q = 3 q = 3 q = 3 q = 4 q = 5 q = 5 q = 5 q = 6 q = 6 q = 7 q = 8 q = 8 q = 9 q = 9 q = 9 q = 10 q = 10 q = 11 q = 12 q = 12 q = 12 q = 13 q = 14 q = 14 q = 15 q = 15 q = 15 q = 16 q = 17 q = 17 q = 17 q = 18 q = 18 q = 19 q = 20 q = 20 q = 20 q = 21 q = 22 q = 22 q = 23 q = 23 q = 23 q = 24 q = 24 q = 25 q = 26 q = 26 q = 27 q = 27 q = 27 q = 28 q = 29 q = 29 q = 29 q = 30 q = 30 q = 31 q = 32 q = 32 q = 33

7   Pass
x = 65; y_correct = 128; assert(isequal(nthodious(x),y_correct))

q = 1 q = 2 q = 2 q = 3 q = 3 q = 3 q = 4 q = 5 q = 5 q = 5 q = 6 q = 6 q = 7 q = 8 q = 8 q = 9 q = 9 q = 9 q = 10 q = 10 q = 11 q = 12 q = 12 q = 12 q = 13 q = 14 q = 14 q = 15 q = 15 q = 15 q = 16 q = 17 q = 17 q = 17 q = 18 q = 18 q = 19 q = 20 q = 20 q = 20 q = 21 q = 22 q = 22 q = 23 q = 23 q = 23 q = 24 q = 24 q = 25 q = 26 q = 26 q = 27 q = 27 q = 27 q = 28 q = 29 q = 29 q = 29 q = 30 q = 30 q = 31 q = 32 q = 32 q = 33 q = 33 q = 33 q = 34 q = 34 q = 35 q = 36 q = 36 q = 36 q = 37 q = 38 q = 38 q = 39 q = 39 q = 39 q = 40 q = 40 q = 41 q = 42 q = 42 q = 43 q = 43 q = 43 q = 44 q = 45 q = 45 q = 45 q = 46 q = 46 q = 47 q = 48 q = 48 q = 48 q = 49 q = 50 q = 50 q = 51 q = 51 q = 51 q = 52 q = 53 q = 53 q = 53 q = 54 q = 54 q = 55 q = 56 q = 56 q = 57 q = 57 q = 57 q = 58 q = 58 q = 59 q = 60 q = 60 q = 60 q = 61 q = 62 q = 62 q = 63 q = 63 q = 63 q = 64 q = 65

8   Pass
x = 3387; y_correct = 6772; assert(isequal(nthodious(x),y_correct))

q = 1 q = 2 q = 2 q = 3 q = 3 q = 3 q = 4 q = 5 q = 5 q = 5 q = 6 q = 6 q = 7 q = 8 q = 8 q = 9 q = 9 q = 9 q = 10 q = 10 q = 11 q = 12 q = 12 q = 12 q = 13 q = 14 q = 14 q = 15 q = 15 q = 15 q = 16 q = 17 q = 17 q = 17 q = 18 q = 18 q = 19 q = 20 q = 20 q = 20 q = 21 q = 22 q = 22 q = 23 q = 23 q = 23 q = 24 q = 24 q = 25 q = 26 q = 26 q = 27 q = 27 q = 27 q = 28 q = 29 q = 29 q = 29 q = 30 q = 30 q = 31 q = 32 q = 32 q = 33 q = 33 q = 33 q = 34 q = 34 q = 35 q = 36 q = 36 q = 36 q = 37 q = 38 q = 38 q = 39 q = 39 q = 39 q = 40 q = 40 q = 41 q = 42 q = 42 q = 43 q = 43 q = 43 q = 44 q = 45 q = 45 q = 45 q = 46 q = 46 q = 47 q = 48 q = 48 q = 48 q = 49 q = 50 q = 50 q = 51 q = 51 q = 51 q = 52 q = 53 q = 53 q = 53 q = 54 q = 54 q = 55 q = 56 q = 56 q = 57 q = 57 q = 57 q = 58 q = 58 q = 59 q = 60 q = 60 q = 60 q = 61 q = 62 q = 62 q = 63 q = 63 q = 63 q = 64 q = 65 q = 65 q = 65 q = 66 q = 66 q = 67 q = 68 q = 68 q = 68 q = 69 q = 70 q = 70 q = 71 q = 71 q = 71 q = 72 q = 72 q = 73 q = 74 q = 74 q = 75 q = 75 q = 75 q = 76 q = 77 q = 77 q = 77 q = 78 q = 78 q = 79 q = 80 q = 80 q = 80 q = 81 q = 82 q = 82 q = 83 q = 83 q = 83 q = 84 q = 85 q = 85 q = 85 q = 86 q = 86 q = 87 q = 88 q = 88 q = 89 q = 89 q = 89 q = 90 q = 90 q = 91 q = 92 q = 92 q = 92 q = 93 q = 94 q = 94 q = 95 q = 95 q = 95 q = 96 q = 96 q = 97 q = 98 q = 98 q = 99 q = 99 q = 99 q = 100 q = 101 q = 101 q = 101 q = 102 q = 102 q = 103 q = 104 q = 104 q = 105 q = 105 q = 105 q = 106 q = 106 q = 107 q = 108 q = 108 q = 108 q = 109 q = 110 q = 110 q = 111 q = 111 q = 111 q = 112 q = 113 q = 113 q = 113 q = 114 q = 114 q = 115 q = 116 q = 116 q = 116 q = 117 q = 118 q = 118 q = 119 q = 119 q = 119 q = 120 q = 120 q = 121 q = 122 q = 122 q = 123 q = 123 q = 123 q = 124 q = 125 q = 125 q = 125 q = 126 q = 126 q = 127 q = 128 q = 128 q = 129 q = 129 q = 129 q = 130 q = 130 q = 131 q = 132 q = 132 q = 132 q = 133 q = 134 q = 134 q = 135 q = 135 q = 135 q = 136 q = 136 q = 137 q = 138 q = 138 q = 139 q = 139 q = 139 q = 140 q = 141 q = 141 q = 141 q = 142 q = 142 q = 143 q = 144 q = 144 q = 144 q = 145 q = 146 q = 146 q = 147 q = 147 q = 147 q = 148 q = 149 q = 149 q = 149 q = 150 q = 150 q = 151 q = 152 q = 152 q = 153 q = 153 q = 153 q = 154 q = 154 q = 155 q = 156 q = 156 q = 156 q = 157 q = 158 q = 158 q = 159 q = 159 q = 159 q = 160 q = 160 q = 161 q = 162 q = 162 q = 163 q = 163 q = 163 q = 164 q = 165 q = 165 q = 165 q = 166 q = 166 q = 167 q = 168 q = 168 q = 169 q = 169 q = 169 q = 170 q = 170 q = 171 q = 172 q = 172 q = 172 q = 173 q = 174 q = 174 q = 175 q = 175 q = 175 q = 176 q = 177 q = 177 q = 177 q = 178 q = 178 q = 179 q = 180 q = 180 q = 180 q = 181 q = 182 q = 182 q = 183 q = 183 q = 183 q = 184 q = 184 q = 185 q = 186 q = 186 q = 187 q = 187 q = 187 q = 188 q = 189 q = 189 q = 189 q = 190 q = 190 q = 191 q = 192 q = 192 q = 192 q = 193 q = 194 q = 194 q = 195 q = 195 q = 195 q = 196 q = 197 q = 197 q = 197 q = 198 q = 198 q = 199 q = 200 q = 200 q = 201 q = 201 q = 201 q = 202 q = 202 q = 203 q = 204 q = 204 q = 204 q = 205 q = 206 q = 206 q = 207 q = 207 q = 207 q = 208 q = 209 q = 209 q = 209 q = 210 q = 210 q = 211 q = 212 q = 212 q = 212 q = 213 q = 214 q = 214 q = 215 q = 215 q = 215 q = 216 q = 216 q = 217 q = 218 q = 218 q = 219 q = 219 q = 219 q = 220 q = 221 q = 221 q = 221 q = 222 q = 222 q = 223 q = 224 q = 224 q = 225 q = 225 q = 225 q = 226 q = 226 q = 227 q = 228 q = 228 q = 228 q = 229 q = 230 q = 230 q = 231 q = 231 q = 231 q = 232 q = 232 q = 233 q = 234 q = 234 q = 235 q = 235 q = 235 q = 236 q = 237 q = 237 q = 237 q = 238 q = 238 q = 239 q = 240 q = 240 q = 240 q = 241 q = 242 q = 242 q = 243 q = 243 q = 243 q = 244 q = 245 q = 245 q = 245 q = 246 q = 246 q = 247 q = 248 q = 248 q = 249 q = 249 q = 249 q = 250 q = 250 q = 251 q = 252 q = 252 q = 252 q = 253 q = 254 q = 254 q = 255 q = 255 q = 255 q = 256 q = 257 q = 257 q = 257 q = 258 q = 258 q = 259 q = 260 q = 260 q = 260 q = 261 q = 262 q = 262 q = 263 q = 263 q = 263 q = 264 q = 264 q = 265 q = 266 q = 266 q = 267 q = 267 q = 267 q = 268 q = 269 q = 269 q = 269 q = 270 q = 270 q = 271 q = 272 q = 272 q = 272 q = 273 q = 274 q = 274 q = 275 q = 275 q = 275 q = 276 q = 277 q = 277 q = 277 q = 278 q = 278 q = 279 q = 280 q = 280 q = 281 q = 281 q = 281 q = 282 q = 282 q = 283 q = 284 q = 284 q = 284 q = 285 q = 286 q = 286 q = 287 q = 287 q = 287 q = 288 q = 288 q = 289 q = 290 q = 290 q = 291 q = 291 q = 291 q = 292 q = 293 q = 293 q = 293 q = 294 q = 294 q = 295 q = 296 q = 296 q = 297 q = 297 q = 297 q = 298 q = 298 q = 299 q = 300 q = 300 q = 300 q = 301 q = 302 q = 302 q = 303 q = 303 q = 303 q = 304 q = 305 q = 305 q = 305 q = 306 q = 306 q = 307 q = 308 q = 308 q = 308 q = 309 q = 310 q = 310 q = 311 q = 311 q = 311 q = 312 q = 312 q = 313 q = 314 q = 314 q = 315 q = 315 q = 315 q = 316 q = 317 q = 317 q = 317 q = 318 q = 318 q = 319 q = 320 q = 320 q = 320 q = 321 q = 322 q = 322 q = 323 q = 323 q = 323 q = 324 q = 325 q = 325 q = 325 q = 326 q = 326 q = 327 q = 328 q = 328 q = 329 q = 329 q = 329 q = 330 q = 330 q = 331 q = 332 q = 332 q = 332 q = 333 q = 334 q = 334 q = 335 q = 335 q = 335 q = 336 q = 337 q = 337 q = 337 q = 338 q = 338 q = 339 q = 340 q = 340 q = 340 q = 341 q = 342 q = 342 q = 343 q = 343 q = 343 q = 344 q = 344 q = 345 q = 346 q = 346 q = 347 q = 347 q = 347 q = 348 q = 349 q = 349 q = 349 q = 350 q = 350 q = 351 q = 352 q = 352 q = 353 q = 353 q = 353 q = 354 q = 354 q = 355 q = 356 q = 356 q = 356 q = 357 q = 358 q = ...

9   Pass
x = 22; y_correct = 42; assert(isequal(nthodious(x),y_correct))

q = 1 q = 2 q = 2 q = 3 q = 3 q = 3 q = 4 q = 5 q = 5 q = 5 q = 6 q = 6 q = 7 q = 8 q = 8 q = 9 q = 9 q = 9 q = 10 q = 10 q = 11 q = 12 q = 12 q = 12 q = 13 q = 14 q = 14 q = 15 q = 15 q = 15 q = 16 q = 17 q = 17 q = 17 q = 18 q = 18 q = 19 q = 20 q = 20 q = 20 q = 21 q = 22

10   Pass
x = 1e5; y_correct = 2e5-1; assert(isequal(nthodious(x),y_correct))

q = 1 q = 2 q = 2 q = 3 q = 3 q = 3 q = 4 q = 5 q = 5 q = 5 q = 6 q = 6 q = 7 q = 8 q = 8 q = 9 q = 9 q = 9 q = 10 q = 10 q = 11 q = 12 q = 12 q = 12 q = 13 q = 14 q = 14 q = 15 q = 15 q = 15 q = 16 q = 17 q = 17 q = 17 q = 18 q = 18 q = 19 q = 20 q = 20 q = 20 q = 21 q = 22 q = 22 q = 23 q = 23 q = 23 q = 24 q = 24 q = 25 q = 26 q = 26 q = 27 q = 27 q = 27 q = 28 q = 29 q = 29 q = 29 q = 30 q = 30 q = 31 q = 32 q = 32 q = 33 q = 33 q = 33 q = 34 q = 34 q = 35 q = 36 q = 36 q = 36 q = 37 q = 38 q = 38 q = 39 q = 39 q = 39 q = 40 q = 40 q = 41 q = 42 q = 42 q = 43 q = 43 q = 43 q = 44 q = 45 q = 45 q = 45 q = 46 q = 46 q = 47 q = 48 q = 48 q = 48 q = 49 q = 50 q = 50 q = 51 q = 51 q = 51 q = 52 q = 53 q = 53 q = 53 q = 54 q = 54 q = 55 q = 56 q = 56 q = 57 q = 57 q = 57 q = 58 q = 58 q = 59 q = 60 q = 60 q = 60 q = 61 q = 62 q = 62 q = 63 q = 63 q = 63 q = 64 q = 65 q = 65 q = 65 q = 66 q = 66 q = 67 q = 68 q = 68 q = 68 q = 69 q = 70 q = 70 q = 71 q = 71 q = 71 q = 72 q = 72 q = 73 q = 74 q = 74 q = 75 q = 75 q = 75 q = 76 q = 77 q = 77 q = 77 q = 78 q = 78 q = 79 q = 80 q = 80 q = 80 q = 81 q = 82 q = 82 q = 83 q = 83 q = 83 q = 84 q = 85 q = 85 q = 85 q = 86 q = 86 q = 87 q = 88 q = 88 q = 89 q = 89 q = 89 q = 90 q = 90 q = 91 q = 92 q = 92 q = 92 q = 93 q = 94 q = 94 q = 95 q = 95 q = 95 q = 96 q = 96 q = 97 q = 98 q = 98 q = 99 q = 99 q = 99 q = 100 q = 101 q = 101 q = 101 q = 102 q = 102 q = 103 q = 104 q = 104 q = 105 q = 105 q = 105 q = 106 q = 106 q = 107 q = 108 q = 108 q = 108 q = 109 q = 110 q = 110 q = 111 q = 111 q = 111 q = 112 q = 113 q = 113 q = 113 q = 114 q = 114 q = 115 q = 116 q = 116 q = 116 q = 117 q = 118 q = 118 q = 119 q = 119 q = 119 q = 120 q = 120 q = 121 q = 122 q = 122 q = 123 q = 123 q = 123 q = 124 q = 125 q = 125 q = 125 q = 126 q = 126 q = 127 q = 128 q = 128 q = 129 q = 129 q = 129 q = 130 q = 130 q = 131 q = 132 q = 132 q = 132 q = 133 q = 134 q = 134 q = 135 q = 135 q = 135 q = 136 q = 136 q = 137 q = 138 q = 138 q = 139 q = 139 q = 139 q = 140 q = 141 q = 141 q = 141 q = 142 q = 142 q = 143 q = 144 q = 144 q = 144 q = 145 q = 146 q = 146 q = 147 q = 147 q = 147 q = 148 q = 149 q = 149 q = 149 q = 150 q = 150 q = 151 q = 152 q = 152 q = 153 q = 153 q = 153 q = 154 q = 154 q = 155 q = 156 q = 156 q = 156 q = 157 q = 158 q = 158 q = 159 q = 159 q = 159 q = 160 q = 160 q = 161 q = 162 q = 162 q = 163 q = 163 q = 163 q = 164 q = 165 q = 165 q = 165 q = 166 q = 166 q = 167 q = 168 q = 168 q = 169 q = 169 q = 169 q = 170 q = 170 q = 171 q = 172 q = 172 q = 172 q = 173 q = 174 q = 174 q = 175 q = 175 q = 175 q = 176 q = 177 q = 177 q = 177 q = 178 q = 178 q = 179 q = 180 q = 180 q = 180 q = 181 q = 182 q = 182 q = 183 q = 183 q = 183 q = 184 q = 184 q = 185 q = 186 q = 186 q = 187 q = 187 q = 187 q = 188 q = 189 q = 189 q = 189 q = 190 q = 190 q = 191 q = 192 q = 192 q = 192 q = 193 q = 194 q = 194 q = 195 q = 195 q = 195 q = 196 q = 197 q = 197 q = 197 q = 198 q = 198 q = 199 q = 200 q = 200 q = 201 q = 201 q = 201 q = 202 q = 202 q = 203 q = 204 q = 204 q = 204 q = 205 q = 206 q = 206 q = 207 q = 207 q = 207 q = 208 q = 209 q = 209 q = 209 q = 210 q = 210 q = 211 q = 212 q = 212 q = 212 q = 213 q = 214 q = 214 q = 215 q = 215 q = 215 q = 216 q = 216 q = 217 q = 218 q = 218 q = 219 q = 219 q = 219 q = 220 q = 221 q = 221 q = 221 q = 222 q = 222 q = 223 q = 224 q = 224 q = 225 q = 225 q = 225 q = 226 q = 226 q = 227 q = 228 q = 228 q = 228 q = 229 q = 230 q = 230 q = 231 q = 231 q = 231 q = 232 q = 232 q = 233 q = 234 q = 234 q = 235 q = 235 q = 235 q = 236 q = 237 q = 237 q = 237 q = 238 q = 238 q = 239 q = 240 q = 240 q = 240 q = 241 q = 242 q = 242 q = 243 q = 243 q = 243 q = 244 q = 245 q = 245 q = 245 q = 246 q = 246 q = 247 q = 248 q = 248 q = 249 q = 249 q = 249 q = 250 q = 250 q = 251 q = 252 q = 252 q = 252 q = 253 q = 254 q = 254 q = 255 q = 255 q = 255 q = 256 q = 257 q = 257 q = 257 q = 258 q = 258 q = 259 q = 260 q = 260 q = 260 q = 261 q = 262 q = 262 q = 263 q = 263 q = 263 q = 264 q = 264 q = 265 q = 266 q = 266 q = 267 q = 267 q = 267 q = 268 q = 269 q = 269 q = 269 q = 270 q = 270 q = 271 q = 272 q = 272 q = 272 q = 273 q = 274 q = 274 q = 275 q = 275 q = 275 q = 276 q = 277 q = 277 q = 277 q = 278 q = 278 q = 279 q = 280 q = 280 q = 281 q = 281 q = 281 q = 282 q = 282 q = 283 q = 284 q = 284 q = 284 q = 285 q = 286 q = 286 q = 287 q = 287 q = 287 q = 288 q = 288 q = 289 q = 290 q = 290 q = 291 q = 291 q = 291 q = 292 q = 293 q = 293 q = 293 q = 294 q = 294 q = 295 q = 296 q = 296 q = 297 q = 297 q = 297 q = 298 q = 298 q = 299 q = 300 q = 300 q = 300 q = 301 q = 302 q = 302 q = 303 q = 303 q = 303 q = 304 q = 305 q = 305 q = 305 q = 306 q = 306 q = 307 q = 308 q = 308 q = 308 q = 309 q = 310 q = 310 q = 311 q = 311 q = 311 q = 312 q = 312 q = 313 q = 314 q = 314 q = 315 q = 315 q = 315 q = 316 q = 317 q = 317 q = 317 q = 318 q = 318 q = 319 q = 320 q = 320 q = 320 q = 321 q = 322 q = 322 q = 323 q = 323 q = 323 q = 324 q = 325 q = 325 q = 325 q = 326 q = 326 q = 327 q = 328 q = 328 q = 329 q = 329 q = 329 q = 330 q = 330 q = 331 q = 332 q = 332 q = 332 q = 333 q = 334 q = 334 q = 335 q = 335 q = 335 q = 336 q = 337 q = 337 q = 337 q = 338 q = 338 q = 339 q = 340 q = 340 q = 340 q = 341 q = 342 q = 342 q = 343 q = 343 q = 343 q = 344 q = 344 q = 345 q = 346 q = 346 q = 347 q = 347 q = 347 q = 348 q = 349 q = 349 q = 349 q = 350 q = 350 q = 351 q = 352 q = 352 q = 353 q = 353 q = 353 q = 354 q = 354 q = 355 q = 356 q = 356 q = 356 q = 357 q = 358 q = ...

11   Pass
% more test cases may be introduced

12   Pass
% DISABLED % ________'FAIR'_SCORING_SYSTEM______________ % % This section scores for usage of ans % and strings, which are common methods % to reduce cody size of solution. % Here, strings are threated like vectors. % Please do not hack it, as this problem % is not mentioned to be a hacking problem. % try assert(false) % size_old = feval(@evalin,'caller','score'); % all_nodes = mtree('nthodious.m','-file'); str_nodes = mtfind(all_nodes,'Kind','STRING'); eq_nodes = mtfind(all_nodes,'Kind','EQUALS'); print_nodes = mtfind(all_nodes,'Kind','PRINT'); expr_nodes = mtfind(all_nodes,'Kind','EXPR'); % size = count(all_nodes) ... +sum(str_nodes.nodesize-1) ... +2*(count(expr_nodes) ... +count(print_nodes) ... -count(eq_nodes)); % feval(@assignin,'caller','score',size); % fprintf('Size in standard cody scoring is %i.\n',size_old); fprintf('Here it is %i.\n',size); end % %_________RESULT_____________________________