Cody

# Problem 46. Which doors are open?

Solution 783722

Submitted on 25 Nov 2015 by Essi
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))

y = 0 y = 1 y = 1

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

y = 0 0 0 y = 1 1 1 y = 1 0 1 y = 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))

y = Columns 1 through 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 49 through 64 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 65 through 80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 81 through 96 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 97 through 100 0 0 0 0 y = Columns 1 through 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 17 through 32 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 33 through 48 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 49 through 64 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 65 through 80 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 81 through 96 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 97 through 100 1 1 1 1 y = Columns 1 through 16 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Columns 17 through 32 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Columns 33 through 48 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Columns 49 through 64 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Columns 65 through 80 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Columns 81 through 96 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 Columns 97 through 100 1 0 1 0 y = Columns 1 through 16 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 Columns 17 through 32 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 Columns 33 through 48 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 Columns 49 through 64 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 Columns 65 through 80 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 Columns 81 through 96 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 Columns 97 through 100 1 0 0 0 y = Columns 1 through 16 1 0 0 1 1 1 1 1 0 0 1 0 1 0 0 1 Columns 17 through 32 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 1 Columns 33 through 48 0 0 1 0 1 0 0 1 1 1 1 1 0 0 1 0 Columns 49 through 64 1 0 0 1 1 1 1 1 0 0 1 0 1 0 0 1 Columns 65 through 80 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 1 Columns 81 through 96 0 0 1 0 1 0 0 1 1 1 1 1 0 0 1 0 Columns 97 through 100 1 0 0 1 y = Columns 1 through 16 1 0 0 1 0 1 1 1 0 1 1 0 1 0 1 1 Columns 17 through 32 1 1 1 0 0 0 1 0 0 0 0 1 1 0 1 1 Columns 33 through 48 0 0 0 0 1 0 0 0 1 1 1 1 1 0 1 0 Columns 49 through 64 1 1 0 1 1 1 0 1 0 0 1 1 1 0 0 1 Columns 65 through 80 0 1 1 1 0 1 1 0 1 0 1 1 1 1 1 0 Columns 81 through 96 0 0 1 0 0 0 0 1 1 0 1 1 0 0 0 0 Columns 97 through 100 1 0 0 0 y = Columns 1 through 16 1 0 0 1 0 0 1 1 0 1 1 1 1 0 1 1 Columns 17 through 32 1 0 1 0 0 0 1 1 0 0 0 1 1 1 1 1 Columns 33 through 48 0 0 0 1 1 0 0 0 1 0 1 1 1 0 1 1 Columns 49 through 64 1 1 0 1 1 0 0 1 0 0 1 0 1 0 0 1 Columns 65 through 80 0 0 1 1 0 1 1 1 1 0 1 1 1 0 1 0 Columns 81 through 96 0 0 1 1 0 0 0 1 1 1 1 1 0 0 0 1 Columns 97 through 100 1 0 0 0 y = Columns 1 through 16 1 0 0 1 0 0 0 1 0 1 1 1 1 1 1 1 Columns 17 through 32 1 0 1 0 1 0 1 1 0 0 0 0 1 1 1 1 Columns 33 through 48 0 0 1 1 1 0 0 0 1 1 1 1 1 0 1 1 Columns 49 through 64 0 1 0 1 1 0 0 0 0 0 1 0 1 0 1 1 Columns 65 through 80 0 0 1 1 0 0 1 1 1 0 1 1 0 0 1 0 Columns 81 through 96 0 0 1 0 0 0 0 1 1 1 0 1 0 0 0 1 Columns 97 through 100 1 1 0 0 y = Columns 1 through 16 1 0 0 1 0 0 0 0 0 1 1 1 1 1 1 0 Columns 17 through 32 1 0 1 0 1 0 1 0 0 0 0 0 1 1 1 0 Columns 33 through 48 0 0 1 1 1 0 0 1 1 1 1 1 1 0 1 0 Columns 49 through 64 0 1 0 1 1 0 0 1 0 0 1 0 1 0 1 0 Columns 65 through 80 0 0 1 1 0 0 1 0 1 0 1 1 0 0 1 1 Columns 81 through 96 0 0 1 0 0 0 0 0 1 1 0 1 0 0 0 0 Columns 97 through 100 1 1 0 0 y = Columns 1 through 16 1 0 0 1 0 0 0 0 1 1 1 1 1 1 1 0 Columns 17 through 32 1 1 1 0 1 0 1 0 0 0 1 0 1 1 1 0 Columns 33 through 48 0 0 1 0 1 0 0 1 1 1 1 1 0 0 1 0 Columns 49 through 64 0 1 0 1 1 1 0 1 0 0 1 0 1 0 0 0 Columns 65 through 80 0 0 1 1 0 0 1 1 1 0 1 1 0 0 1 1 Columns 81 through 96 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 Columns 97 through 100 1 1 1 0 y = Columns 1 through 16 1 0 0 1 0 0 0 0 1 0 1 1 1 1 1 0 Columns 17 through 32 1 1 1 1 1 0 1 0 0 0 1 0 1 0 1 0 Columns 33 through 48 0 0 1 0 1 0 0 0 1 1 1 1 0 0 1 0 Columns 49 through 64 0 0 0 1 1 1 0 1 0 0 1 1 1 0 0 0 Columns 65 through 80 0 0 1 1 0 1 1 1 1 0 1 1 0 0 1 0 Columns 81 through 96 1 0 1 0 0 0 0 0 1 1 0 1 0 0 0 0 Columns 97 through 100 1 1 1 1 y = Columns 1 through 16 1 0 0 1 0 0 0 0 1 0 0 1 1 1 1 0 Columns 17 through 32 1 1 1 1 1 1 1 0 0 0 1 0 1 0 1 0 Columns 33 through 48 1 0 1 0 1 0 0 0 1 1 1 0 0 0 1 0 Columns 49 through 64 0 0 0 1 1 1 1 1 0 0 1 1 1 0 0 0 Columns 65 through 80 0 1 1 1 0 1 1 1 1 0 1 1 1 0 1 0 Columns 81 through 96 1 0 1 0 0 0 0 1 1 1 0 1 0 0 0 0 Columns 97 through 100 1 1 0 1 y = Columns 1 through 16 1 0 0 1 0 0 0 0 1 0 0 0 1 1 1 0 Columns 17 through 32 1 1 1 1 1 1 1 1 0 0 1 0 1 0 1 0 Columns 33 through 48 1 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 Columns 49 through 64 0 0 0 1 1 1 1 1 0 0 1 0 1 0 0 0 Columns 65 through 80 0 1 1 1 0 1 1 0 1 0 1 1 1 0 1 0 Columns 81 through 96 1 0 1 ...

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!