Cody

# Problem 2317. Distance of the centroids of the balls

Solution 1911446

Submitted on 25 Aug 2019
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
n = 1e3; l = 10; r = 0.5; p = [ repmat([.5:9.5]',l^2,1),... repmat(reshape(repmat([.5:9.5]',1,10)',l^2,1),l,1),... reshape(repmat([.5:9.5]',1,100)',l^3,1)]; A_test = zeros(l^3); for i1 = 1:l^3 for i2 = 1:l^3 A_test(i1, i2) = norm(p(i1,:)-p(i2,:)); end end assert(isequal(dist_ball(p),A_test))

Undefined function 'dist_ball' for input arguments of type 'double'. Error in Test1 (line 13) assert(isequal(dist_ball(p),A_test))

2   Fail
n = randi(1e2) p = randi([-1e6,1e6],n,3); A_test = zeros(n); for i1 = 1:n for i2 = 1:n A_test(i1, i2) = norm(p(i1,:)-p(i2,:)); end end assert(isequal(dist_ball(p),A_test))

n = 24

Undefined function 'dist_ball' for input arguments of type 'double'. Error in Test2 (line 9) assert(isequal(dist_ball(p),A_test))

3   Fail
assert( isempty(regexp(evalc('type dist_ball'),'(str|printf|eval|flip|dec2base|regexp)')) )

Error using type File 'dist_ball' not found. Error in Test3 (line 1) assert( isempty(regexp(evalc('type dist_ball'),'(str|printf|eval|flip|dec2base|regexp)')) )

### Community Treasure Hunt

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

Start Hunting!