Cody

Solution 59193

Submitted on 10 Mar 2012 by Bart
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(nCardsProblem(x),y_correct))
x = 1
2   Pass
%% x = 5; y_correct = 2; assert(isequal(nCardsProblem(x),y_correct))
x = 1 2 3 4 5
3   Pass
%% x = 50; y_correct = 36; assert(isequal(nCardsProblem(x),y_correct))
x = Columns 1 through 10 1 2 3 4 5 6 7 8 9 10 Columns 11 through 20 11 12 13 14 15 16 17 18 19 20 Columns 21 through 30 21 22 23 24 25 26 27 28 29 30 Columns 31 through 40 31 32 33 34 35 36 37 38 39 40 Columns 41 through 50 41 42 43 44 45 46 47 48 49 50
4   Pass
%% x = 1000; y_correct = 976; assert(isequal(nCardsProblem(x),y_correct))
x = Columns 1 through 5 1 2 3 4 5 Columns 6 through 10 6 7 8 9 10 Columns 11 through 15 11 12 13 14 15 Columns 16 through 20 16 17 18 19 20 Columns 21 through 25 21 22 23 24 25 Columns 26 through 30 26 27 28 29 30 Columns 31 through 35 31 32 33 34 35 Columns 36 through 40 36 37 38 39 40 Columns 41 through 45 41 42 43 44 45 Columns 46 through 50 46 47 48 49 50 Columns 51 through 55 51 52 53 54 55 Columns 56 through 60 56 57 58 59 60 Columns 61 through 65 61 62 63 64 65 Columns 66 through 70 66 67 68 69 70 Columns 71 through 75 71 72 73 74 75 Columns 76 through 80 76 77 78 79 80 Columns 81 through 85 81 82 83 84 85 Columns 86 through 90 86 87 88 89 90 Columns 91 through 95 91 92 93 94 95 Columns 96 through 100 96 97 98 99 100 Columns 101 through 105 101 102 103 104 105 Columns 106 through 110 106 107 108 109 110 Columns 111 through 115 111 112 113 114 115 Columns 116 through 120 116 117 118 119 120 Columns 121 through 125 121 122 123 124 125 Columns 126 through 130 126 127 128 129 130 Columns 131 through 135 131 132 133 134 135 Columns 136 through 140 136 137 138 139 140 Columns 141 through 145 141 142 143 144 145 Columns 146 through 150 146 147 148 149 150 Columns 151 through 155 151 152 153 154 155 Columns 156 through 160 156 157 158 159 160 Columns 161 through 165 161 162 163 164 165 Columns 166 through 170 166 167 168 169 170 Columns 171 through 175 171 172 173 174 175 Columns 176 through 180 176 177 178 179 180 Columns 181 through 185 181 182 183 184 185 Columns 186 through 190 186 187 188 189 190 Columns 191 through 195 191 192 193 194 195 Columns 196 through 200 196 197 198 199 200 Columns 201 through 205 201 202 203 204 205 Columns 206 through 210 206 207 208 209 210 Columns 211 through 215 211 212 213 214 215 Columns 216 through 220 216 217 218 219 220 Columns 221 through 225 221 222 223 224 225 Columns 226 through 230 226 227 228 229 230 Columns 231 through 235 231 232 233 234 235 Columns 236 through 240 236 237 238 239 240 Columns 241 through 245 241 242 243 244 245 Columns 246 through 250 246 247 248 249 250 Columns 251 through 255 251 252 253 254 255 Columns 256 through 260 256 257 258 259 260 Columns 261 through 265 261 262 263 264 265 Columns 266 through 270 266 267 268 269 270 Columns 271 through 275 271 272 273 274 275 Columns 276 through 280 276 277 278 279 280 Columns 281 through 285 281 282 283 284 285 Columns 286 through 290 286 287 288 289 290 Columns 291 through 295 291 292 293 294 295 Columns 296 through 300 296 297 298 299 300 Columns 301 through 305 301 302 303 304 305 Columns 306 through 310 306 307 308 309 310 Columns 311 through 315 311 312 313 314 315 Columns 316 through 320 316 317 318 319 320 Columns 321 through 325 321 322 323 324 325 Columns 326 through 330 326 327 328 329 330 Columns 331 through 335 331 332 333 334 335 Columns 336 through 340 336 337 338 339 340 Columns 341 through 345 341 342 343 344 345 Columns 346 through 350 346 347 348 349 350 Columns 351 through 355 351 352 353 354 355 Columns 356 through 360 356 357 358 359 360 Columns 361 through 365 361 362 363 364 365 Columns 366 through 370 366 367 368 369 370 Columns 371 through 375 371 372 373 374 375 Columns 376 through 380 376 377 378 379 380 Columns 381 through 385 381 382 383 384 385 Columns 386 through 390 386 387 388 389 390 Columns 391 through 395 391 392 393 394 395 Columns 396 through 400 396 397 398 399 400 Columns 401 through 405 401 402 403 404 405 Columns 406 through 410 406 407 408 409 410 Columns 411 through 415 411 412 413 414 415 Columns 416 through 420 416 417 418 419 420 Columns 421 through 425 421 422 423 424 425 Columns 426 through 430 426 427 428 429 430 Columns 431 through 435 431 432 433 434 435 Columns 436 through 440 436 437 438 439 440 Columns 441 through 445 441 442 443 444 445 Columns 446 through 450 446 447 448 449 450 Columns 451 through 455 451 452 453 454 455 Columns 456 through 460 456 457 458 459 460 Columns 461 through 465 461 462 463 464 465 Columns 466 through 470 466 467 468 469 470 Columns 471 through 475 471 472 473 474 475 Columns 476 through 480 476 477 478 479 480 Columns 481 through 485 481 482 483 484 485 Columns 486 through 490 486 487 488 489 490 Columns 491 through 495 491 492 493 494 495 Columns 496 through 500 496 497 498 499 500 Columns 501 through 505 501 502 503 504 505 Columns 506 through 510 506 507 508 509 510 Columns 511 through 515 511 512 513 514 515 Columns 516 through 520 516 517 518 519 520 Columns 521 through 525 521 522 523 524 525 Columns 526 through 530 526 527 528 529 530 Columns 531 through 535 531 532 533 534 535 Columns 536 through 540 536 537 538 539 540 Columns 541 through 545 541 542 543 544 545 Columns 546 through 550 546 547 548 549 550 Columns 551 through 555 551 552 553 554 555 Columns 556 through 560 556 557 558 559 560 Columns 561 through 565 561 562 563 564 565 Columns 566 through 570 566 567 568 569 570 Columns 571 through 575 571 572 573 574 575 Columns 576 through 580 ...
5   Pass
%% x = 10000; y_correct = 3616; assert(isequal(nCardsProblem(x),y_correct))
x = Columns 1 through 5 1 2 3 4 5 Columns 6 through 10 6 7 8 9 10 Columns 11 through 15 11 12 13 14 15 Columns 16 through 20 16 17 18 19 20 Columns 21 through 25 21 22 23 24 25 Columns 26 through 30 26 27 28 29 30 Columns 31 through 35 31 32 33 34 35 Columns 36 through 40 36 37 38 39 40 Columns 41 through 45 41 42 43 44 45 Columns 46 through 50 46 47 48 49 50 Columns 51 through 55 51 52 53 54 55 Columns 56 through 60 56 57 58 59 60 Columns 61 through 65 61 62 63 64 65 Columns 66 through 70 66 67 68 69 70 Columns 71 through 75 71 72 73 74 75 Columns 76 through 80 76 77 78 79 80 Columns 81 through 85 81 82 83 84 85 Columns 86 through 90 86 87 88 89 90 Columns 91 through 95 91 92 93 94 95 Columns 96 through 100 96 97 98 99 100 Columns 101 through 105 101 102 103 104 105 Columns 106 through 110 106 107 108 109 110 Columns 111 through 115 111 112 113 114 115 Columns 116 through 120 116 117 118 119 120 Columns 121 through 125 121 122 123 124 125 Columns 126 through 130 126 127 128 129 130 Columns 131 through 135 131 132 133 134 135 Columns 136 through 140 136 137 138 139 140 Columns 141 through 145 141 142 143 144 145 Columns 146 through 150 146 147 148 149 150 Columns 151 through 155 151 152 153 154 155 Columns 156 through 160 156 157 158 159 160 Columns 161 through 165 161 162 163 164 165 Columns 166 through 170 166 167 168 169 170 Columns 171 through 175 171 172 173 174 175 Columns 176 through 180 176 177 178 179 180 Columns 181 through 185 181 182 183 184 185 Columns 186 through 190 186 187 188 189 190 Columns 191 through 195 191 192 193 194 195 Columns 196 through 200 196 197 198 199 200 Columns 201 through 205 201 202 203 204 205 Columns 206 through 210 206 207 208 209 210 Columns 211 through 215 211 212 213 214 215 Columns 216 through 220 216 217 218 219 220 Columns 221 through 225 221 222 223 224 225 Columns 226 through 230 226 227 228 229 230 Columns 231 through 235 231 232 233 234 235 Columns 236 through 240 236 237 238 239 240 Columns 241 through 245 241 242 243 244 245 Columns 246 through 250 246 247 248 249 250 Columns 251 through 255 251 252 253 254 255 Columns 256 through 260 256 257 258 259 260 Columns 261 through 265 261 262 263 264 265 Columns 266 through 270 266 267 268 269 270 Columns 271 through 275 271 272 273 274 275 Columns 276 through 280 276 277 278 279 280 Columns 281 through 285 281 282 283 284 285 Columns 286 through 290 286 287 288 289 290 Columns 291 through 295 291 292 293 294 295 Columns 296 through 300 296 297 298 299 300 Columns 301 through 305 301 302 303 304 305 Columns 306 through 310 306 307 308 309 310 Columns 311 through 315 311 312 313 314 315 Columns 316 through 320 316 317 318 319 320 Columns 321 through 325 321 322 323 324 325 Columns 326 through 330 326 327 328 329 330 Columns 331 through 335 331 332 333 334 335 Columns 336 through 340 336 337 338 339 340 Columns 341 through 345 341 342 343 344 345 Columns 346 through 350 346 347 348 349 350 Columns 351 through 355 351 352 353 354 355 Columns 356 through 360 356 357 358 359 360 Columns 361 through 365 361 362 363 364 365 Columns 366 through 370 366 367 368 369 370 Columns 371 through 375 371 372 373 374 375 Columns 376 through 380 376 377 378 379 380 Columns 381 through 385 381 382 383 384 385 Columns 386 through 390 386 387 388 389 390 Columns 391 through 395 391 392 393 394 395 Columns 396 through 400 396 397 398 399 400 Columns 401 through 405 401 402 403 404 405 Columns 406 through 410 406 407 408 409 410 Columns 411 through 415 411 412 413 414 415 Columns 416 through 420 416 417 418 419 420 Columns 421 through 425 421 422 423 424 425 Columns 426 through 430 426 427 428 429 430 Columns 431 through 435 431 432 433 434 435 Columns 436 through 440 436 437 438 439 440 Columns 441 through 445 441 442 443 444 445 Columns 446 through 450 446 447 448 449 450 Columns 451 through 455 451 452 453 454 455 Columns 456 through 460 456 457 458 459 460 Columns 461 through 465 461 462 463 464 465 Columns 466 through 470 466 467 468 469 470 Columns 471 through 475 471 472 473 474 475 Columns 476 through 480 476 477 478 479 480 Columns 481 through 485 481 482 483 484 485 Columns 486 through 490 486 487 488 489 490 Columns 491 through 495 491 492 493 494 495 Columns 496 through 500 496 497 498 499 500 Columns 501 through 505 501 502 503 504 505 Columns 506 through 510 506 507 508 509 510 Columns 511 through 515 511 512 513 514 515 Columns 516 through 520 516 517 518 519 520 Columns 521 through 525 521 522 523 524 525 Columns 526 through 530 526 527 528 529 530 Columns 531 through 535 531 532 533 534 535 Columns 536 through 540 536 537 538 539 540 Columns 541 through 545 541 542 543 544 545 Columns 546 through 550 546 547 548 549 550 Columns 551 through 555 551 552 553 554 555 Columns 556 through 560 556 557 558 559 560 Columns 561 through 565 561 562 563 564 565 Columns 566 through 570 566 567 568 569 570 Columns 571 through 575 571 572 573 574 575 Columns 576 through 580 ...