Cody

Problem 46. Which doors are open?

Solution 1699600

Submitted on 26 Dec 2018 by Nikolaos Nikolaou
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(which_doors_open(x),y_correct))

x = 1 p = 1 y = 1

2   Pass
x = 3; y_correct = 1; assert(isequal(which_doors_open(x),y_correct))

x = 1 2 3 p = 1 1 1 x = 2 p = 1 0 1 x = 3 p = 1 0 0 y = 1

3   Pass
x = 100; y_correct = [1 4 9 16 25 36 49 64 81 100]; assert(isequal(which_doors_open(x),y_correct))

x = Columns 1 through 29 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 Columns 30 through 58 30 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 Columns 59 through 87 59 60 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 Columns 88 through 100 88 89 90 91 92 93 94 95 96 97 98 99 100 p = Columns 1 through 29 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 30 through 58 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 59 through 87 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 88 through 100 1 1 1 1 1 1 1 1 1 1 1 1 1 x = Columns 1 through 29 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 Columns 30 through 50 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 p = Columns 1 through 29 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Columns 30 through 58 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Columns 59 through 87 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Columns 88 through 100 0 1 0 1 0 1 0 1 0 1 0 1 0 x = Columns 1 through 29 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 Columns 30 through 33 90 93 96 99 p = Columns 1 through 29 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 Columns 30 through 58 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 Columns 59 through 87 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 Columns 88 through 100 0 1 1 1 0 0 0 1 1 1 0 0 0 x = 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 p = Columns 1 through 29 1 0 0 1 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 1 0 0 1 0 1 0 0 1 1 Columns 30 through 58 1 1 1 0 0 1 0 1 0 0 1 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 1 0 0 Columns 59 through 87 1 0 1 0 0 1 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 1 0 0 1 0 1 0 0 Columns 88 through 100 1 1 1 1 1 0 0 1 0 1 0 0 1 x = 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 p = Columns 1 through 29 1 0 0 1 0 1 1 1 0 1 1 0 1 0 1 1 1 1 1 0 0 0 1 0 0 0 0 1 1 Columns 30 through 58 0 1 1 0 0 0 0 1 0 0 0 1 1 1 1 1 0 1 0 1 1 0 1 1 1 0 1 0 0 Columns 59 through 87 1 1 1 0 0 1 0 1 1 1 0 1 1 0 1 0 1 1 1 1 1 0 0 0 1 0 0 0 0 Columns 88 through 100 1 1 0 1 1 0 0 0 0 1 0 0 0 x = 6 12 18 24 30 36 42 48 54 60 66 72 78 84 90 96 p = Columns 1 through 29 1 0 0 1 0 0 1 1 0 1 1 1 1 0 1 1 1 0 1 0 0 0 1 1 0 0 0 1 1 Columns 30 through 58 1 1 1 0 0 0 1 1 0 0 0 1 0 1 1 1 0 1 1 1 1 0 1 1 0 0 1 0 0 Columns 59 through 87 1 0 1 0 0 1 0 0 1 1 0 1 1 1 1 0 1 1 1 0 1 0 0 0 1 1 0 0 0 Columns 88 through 100 1 1 1 1 1 0 0 0 1 1 0 0 0 x = 7 14 21 28 35 42 49 56 63 70 77 84 91 98 p = Columns 1 through 29 1 0 0 1 0 0 0 1 0 1 1 1 1 1 1 1 1 0 1 0 1 0 1 1 0 0 0 0 1 Columns 30 through 58 1 1 1 0 0 1 1 1 0 0 0 1 1 1 1 1 0 1 1 0 1 0 1 1 0 0 0 0 0 Columns 59 through 87 1 0 1 0 1 1 0 0 1 1 0 0 1 1 1 0 1 1 0 0 1 0 0 0 1 0 0 0 0 Columns 88 through 100 1 1 1 0 1 0 0 0 1 1 1 0 0 x = 8 16 24 32 40 48 56 64 72 80 88 96 p = Columns 1 through 29 1 0 0 1 0 0 0 0 0 1 1 1 1 1 1 0 1 0 1 0 1 0 1 0 0 0 0 0 1 Columns 30 through 58 1 1 0 0 0 1 1 1 0 0 1 1 1 1 1 1 0 1 0 0 1 0 1 1 0 0 1 0 0 Columns 59 through 87 1 0 1 0 1 0 0 0 1 1 0 0 1 0 1 0 1 1 0 0 1 1 0 0 1 0 0 0 0 Columns 88 through 100 0 1 1 0 1 0 0 0 0 1 1 0 0 x = 9 18 27 36 45 54 63 72 81 90 99 p = Columns 1 through 29 1 0 0 1 0 0 0 0 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 0 0 0 1 0 1 Columns 30 through 58 1 1 0 0 0 1 0 1 0 0 1 1 1 1 1 0 0 1 0 0 1 0 1 1 1 0 1 0 0 Columns 59 through 87 1 0 1 0 0 0 0 0 1 1 0 0 1 1 1 0 1 1 0 0 1 1 1 0 1 0 0 0 0 Columns 88 through 100 0 1 0 0 1 0 0 0 0 1 1 1 0 x = 10 20 30 40 50 60 70 80 90 100 p = Columns 1 through 29 1 0 0 1 0 0 0 0 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 0 0 0 1 0 1 Columns 30 through 58 0 1 0 0 0 1 0 1 0 0 0 1 1 1 1 0 0 1 0 0 0 0 1 1 1 0 1 0 0 Columns 59 through 87 1 1 1 0 0 0 0 0 1 1 0 1 1 1 1 0 1 1 0 0 1 0 1 0 1 0 0 0 0 Columns 88 through 100 0 1 1 0 1 0 0 0 0 1 1 1 1 x = 11 22 33 44 55 66 77 88 99 p = Columns 1 through 29 1 0 0 1 0 0 0 0 1 0 0 1 1 1 1 0 1 1 1 1 1 1 1 0 0 0 1 0 1 Columns 30 through 58 0 1 0 1 0 1 0 1 0 0 0 1 1 1 0 0 0 1 0 0 0 0 1 1 1 1 1 0 0 Columns 59 through 87 1 1 1 0 0 0 0 1 1 1 0 1 1 1 1 0 1 1 1 0 1 0 1 0 1 0 0 0 0 Columns 88 through 100 1 1 1 0 1 0 0 0 0 1 1 0 1 x = 12 24 36 48 60 72 84 ...