Cody

Solution 814993

Submitted on 27 Jan 2016
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   Fail
%% x = 1; y_correct = 0; assert(isequal(politeness(x),y_correct))

Undefined function or variable 'b'.

2   Fail
%% x = 2; y_correct = 0; assert(isequal(politeness(x),y_correct))

Undefined function or variable 'b'.

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

3 = sum(1:2);

4   Pass
%% x = 7; y_correct = 1; assert(isequal(politeness(x),y_correct))

7 = sum(3:4);

5   Pass
%% x = 9; y_correct = 2; assert(isequal(politeness(x),y_correct))

9 = sum(4:5); 9 = sum(2:4);

6   Fail
%% x = 15; y_correct = 3; assert(isequal(politeness(x),y_correct))

15 = sum(7:8); 15 = sum(0:5); 15 = sum(4:6); 15 = sum(1:5);

Assertion failed.

7   Pass
%% x = 18; y_correct = 2; assert(isequal(politeness(x),y_correct))

18 = sum(3:6); 18 = sum(5:7);

8   Fail
%% x = 21; y_correct = 3; assert(isequal(politeness(x),y_correct))

21 = sum(10:11); 21 = sum(1:6); 21 = sum(6:8); 21 = sum(0:6);

Assertion failed.

9   Fail
%% x = 1024; y_correct = 0; assert(isequal(politeness(x),y_correct))

Undefined function or variable 'b'.

10   Fail
%% x = 1025; y_correct = 5; assert(isequal(politeness(x),y_correct))

1025 = sum(512:513); 1025 = sum(98:107); 1025 = sum(-4:45); 1025 = sum(-28:53); 1025 = sum(-202:207); 1025 = sum(203:207); 1025 = sum(29:53); 1025 = sum(5:45); 1025 = sum(-97:107);

Assertion failed.

11   Fail
%% x = 25215; y_correct = 11; assert(isequal(politeness(x),y_correct))

25215 = sum(12607:12608); 25215 = sum(4200:4205); 25215 = sum(2517:2526); 25215 = sum(826:855); 25215 = sum(267:348); 25215 = sum(-20:225); 25215 = sum(-143:266); 25215 = sum(-594:635); 25215 = sum(-1673:1688); 25215 = sum(-5040:5045); 25215 = sum(8404:8406); 25215 = sum(5041:5045); 25215 = sum(1674:1688); 25215 = sum(595:635); 25215 = sum(144:266); 25215 = sum(21:225); 25215 = sum(-266:348); 25215 = sum(-825:855); 25215 = sum(-2516:2526); 25215 = sum(-4199:4205);

Assertion failed.

12   Pass
%% x = 62; y_correct = 1; assert(isequal(politeness(x),y_correct))

62 = sum(14:17);

13   Fail
%% x = 63; y_correct = 5; assert(isequal(politeness(x),y_correct))

63 = sum(31:32); 63 = sum(8:13); 63 = sum(-2:11); 63 = sum(-5:12); 63 = sum(20:22); 63 = sum(6:12); 63 = sum(3:11); 63 = sum(-7:13);

Assertion failed.

14   Fail
%% x = 65; y_correct = 3; assert(isequal(politeness(x),y_correct))

65 = sum(32:33); 65 = sum(2:11); 65 = sum(-10:15); 65 = sum(11:15); 65 = sum(-1:11);

Assertion failed.

15   Fail
%% % anti-lookup & clue nums=primes(200); pattern=[1 nums([false ~randi([0 25],1,45)])]; x=prod(pattern)*2^randi([0 5]); y_correct=2^numel(pattern)/2-1; assert(isequal(politeness(x),y_correct))

244 = sum(27:34); 244 = sum(-26:34);

Assertion failed.

16   Fail
%% for k=randi(2e4,1,20) assert(isequal(politeness(k*(k-1))+1,(politeness(k)+1)*(politeness(k-1)+1))) end

3.11575e+08 = sum(3.89469e+07:3.89469e+07); 3.11575e+08 = sum(1.29823e+07:1.29823e+07); 3.11575e+08 = sum(2.04976e+06:2.04991e+06); 3.11575e+08 = sum(683052:683507); 3.11575e+08 = sum(38208:45639); 3.11575e+08 = sum(20593:32360); 3.11575e+08 = sum(2827:25122); 3.11575e+08 = sum(-8826:26477); 3.11575e+08 = sum(-68397:72810); 3.11575e+08 = sum(-110402:113189); 3.11575e+08 = sum(-211076:212547); 3.11575e+08 = sum(-334923:335852); 3.11575e+08 = sum(-5.46621e+06:5.46626e+06); 3.11575e+08 = sum(-1.63987e+07:1.63987e+07); 3.11575e+08 = sum(1.03858e+08:1.03858e+08); 3.11575e+08 = sum(1.63987e+07:1.63987e+07); 3.11575e+08 = sum(5.46621e+06:5.46626e+06); 3.11575e+08 = sum(334924:335852); 3.11575e+08 = sum(211077:212547); 3.11575e+08 = sum(110403:113189); 3.11575e+08 = sum(68398:72810); 3.11575e+08 = sum(8827:26477); 3.11575e+08 = sum(-2826:25122); 3.11575e+08 = sum(-20592:32360); 3.11575e+08 = sum(-38207:45639); 3.11575e+08 = sum(-683051:683507); 3.11575e+08 = sum(-2.04976e+06:2.04991e+06); 3.11575e+08 = sum(-1.29823e+07:1.29823e+07); 3.11575e+08 = sum(-3.89469e+07:3.89469e+07); 17652 = sum(2203:2210); 17652 = sum(724:747); 17652 = sum(5883:5885); 17652 = sum(-723:747); 17652 = sum(-2202:2210); 17651 = sum(8825:8826); 17651 = sum(446:483); 17651 = sum(-919:938); 17651 = sum(920:938); 17651 = sum(-445:483);

Assertion failed.

Suggested Problems

More from this Author47