Cody

Solution 1358023

Submitted on 27 Nov 2017 by Sanghai Guan
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Pass
assessFunctionAbsence({'regexp','regexpi','regexprep','str2num'},'FileName','fivesteps.m') assert(isempty(regexp(fileread('fivesteps.m'),'assert'))); [~,~]=system('rm freepass*');

2   Pass
%lines=textread('fivesteps.m','%s'); %id=str2num(regexp(lines{end},'\d+','match','once')); %assert(~ismember(id,[3931805,3397427]),'Please submit a valid non-cheating solution and ask the problem author to manually evaluate it');

3   Pass
% X,Y X<Y between 2 and 100 [x,y]=find(triu(ones(100),1)); z=[x y]; valid=all(z>1,2); assert(fivesteps(z(valid,:))==true);

4   Pass
% X,Y X<Y between 2 and 60 [x,y]=find(triu(ones(60),1)); z=[x y]; valid=all(z>1,2); assert(fivesteps(z(valid,:))==false);

5   Pass
% X,Y X<Y between 2 and 200 [x,y]=find(triu(ones(200),1)); z=[x y]; valid=all(z>1,2); assert(fivesteps(z(valid,:))==true);

6   Pass
% X,Y X<Y between 2 and 1680 [x,y]=find(triu(ones(1680),1)); z=[x y]; valid=all(z>1,2); assert(fivesteps(z(valid,:))==true);

7   Pass
% X,Y X<Y between 2 and 1700 [x,y]=find(triu(ones(1700),1)); z=[x y]; valid=all(z>1,2); assert(fivesteps(z(valid,:))==false);

8   Pass
% X,Y X<Y between 1 and 20 [x,y]=find(triu(ones(20),1)); z=[x y]; valid=all(z>=1,2); assert(fivesteps(z(valid,:))==false);

9   Pass
% X,Y X<Y between 1 and 30 [x,y]=find(triu(ones(30),1)); z=[x y]; valid=all(z>=1,2); assert(fivesteps(z(valid,:))==true);

10   Pass
% X,Y X<Y between 1 and 40 [x,y]=find(triu(ones(40),1)); z=[x y]; valid=all(z>=1,2); assert(fivesteps(z(valid,:))==false);

11   Pass
% X,Y X<Y between 3 and 5000 [x,y]=find(triu(ones(3000),1)); z=[x y]; valid=all(z>=3,2); assert(fivesteps(z(valid,:))==true);

12   Pass
% X,Y X<Y between 3 and 100 [x,y]=find(triu(ones(100),1)); z=[x y]; valid=all(z>=3,2); assert(fivesteps(z(valid,:))==false);

13   Pass
% X,Y X<Y even between 2 and 40 [x,y]=meshgrid(2:2:40); z=[x(:) y(:)]; valid=y>x; assert(fivesteps(z(valid,:))==false);

14   Pass
% X,Y X<Y odd between 1 and 1000 [x,y]=meshgrid(1:2:1000); z=[x(:) y(:)]; valid=y>x; assert(fivesteps(z(valid,:))==true);

15   Pass
% X,Y X<Y non-primes between 1 and 50 [x,y]=meshgrid(setdiff(1:50,primes(50))); z=[x(:) y(:)]; valid=y>x; assert(fivesteps(z(valid,:))==true);

16   Pass
% X,Y X<Y primes between 1 and 50 [x,y]=meshgrid(primes(50)); z=[x(:) y(:)]; valid=y>x; assert(fivesteps(z(valid,:))==false);

17   Pass
% X,Y X<Y random subset [x,y]=meshgrid([3 5 12 18 20 28 30]); z=[x(:) y(:)]; valid=y>x; assert(fivesteps(z(valid,:))==true);

18   Pass
% X,Y X<Y random subset [x,y]=meshgrid([3 5 12 15 28 30]); z=[x(:) y(:)]; valid=y>x; assert(fivesteps(z(valid,:))==false);

19   Pass
% X,Y X<Y random subset [x,y]=meshgrid([2 4 6 8 12 16 18]); z=[x(:) y(:)]; valid=y>x; assert(fivesteps(z(valid,:))==false);

20   Pass
% X,Y X<Y random subset [x,y]=meshgrid([4 6 8 12 16 18]); z=[x(:) y(:)]; valid=y>x; assert(fivesteps(z(valid,:))==true);

21   Pass
% X,Y X<Y random subset [x,y]=meshgrid([2 3 10 14 15 20 21]); z=[x(:) y(:)]; valid=y>x; assert(fivesteps(z(valid,:))==true);

22   Pass
% X,Y X<Y random subset [x,y]=meshgrid([2 3 5 8 10 14 15 20 21]); z=[x(:) y(:)]; valid=y>x; assert(fivesteps(z(valid,:))==false);

23   Pass
% X,Y X<Y between 3 and 100 [x,y]=find(triu(ones(randi([10,100])),1)); z=[x y]; valid=all(z>2,2); assert(fivesteps(z(valid,:))==false);

24   Pass
% X,Y X<Y between 1 and 100 [x,y]=find(triu(ones(randi([10,100])),1)); z=[x y]; valid=all(z>=1,2); assert(fivesteps(z(valid,:))==false);

25   Pass
% X,Y X<Y between 2 and 100 [x,y]=find(triu(ones(randi([62,100])),1)); z=[x y]; valid=all(z>1,2); assert(fivesteps(z(valid,:))==true);

26   Pass
% X,Y X<Y between 2 and 100 [x,y]=find(triu(ones(randi([10,61])),1)); z=[x y]; valid=all(z>1,2); assert(fivesteps(z(valid,:))==false);

27   Pass
assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[1408681,124750,4851,4492503]),regexp(fileread('fivesteps.m'),'((\s*[\+\-\*\/]\s*)?[\d\.])+','match'))),'please do not use look-up table solutions');