Solution 182783

Submitted on 29 Dec 2012
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
%% feval(@assignin,'caller','score',8000);

2   Pass
%% filetext = fileread('encode_decode.m'); % Avoid Size 0 solutions assert(isempty(strfind(filetext, 'persistent'))) assert(isempty(strfind(filetext, 'global')))

3   Fail
%% x=randi(2^32-1,1000); dirfiles_orig=dir; num_orig=size(dirfiles_orig,1); fname=encode_decode(x); dirfiles=dir; num_encode=size(dirfiles,1); c=dir(fname); fprintf('Bytes %i\n',c.bytes) file_size=floor(c.bytes/1000); assert(num_encode==num_orig+1,'Virus Detected'); xout=encode_decode(fname); assert(file_size<4100,sprintf('File Size %i\n',file_size)) assert(isequal(x,xout),'xout ~= x') feval( @assignin,'caller','score',floor(min( 8000,file_size )) );

Error: Invalid file identifier. Use fopen to generate a valid file identifier.