Cody

Problem 225. Subdivide the Segment

Solution 564844

Submitted on 25 Jan 2015 by bkzcnldw
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
%% P1 = [1,8]; P2 = [0,5]; n_correct = 2; assert(isequal(divide_segment(P1,P2),n_correct))

ans = 2

2   Pass
%% P1 = [-807,541]; P2 = [-714,681]; n_correct = 41; assert(isequal(divide_segment(P1,P2),n_correct))

ans = 41

3   Pass
%% P1 = [1901,-1638]; P2 = [2046,-1472]; n_correct = 13; assert(isequal(divide_segment(P1,P2),n_correct))

ans = 13

4   Pass
%% P1 = [25631,-16475]; P2 = [26580,-15005]; n_correct = 29; assert(isequal(divide_segment(P1,P2),n_correct))

ans = 29

5   Pass
%% P1 = [1543,-188]; P2 = [2054,3250]; n_correct = 85; assert(isequal(divide_segment(P1,P2),n_correct))

ans = 85

6   Pass
%% P1 = [-26140,17799]; P2 = [11092,72482]; n_correct = 75149; assert(isequal(divide_segment(P1,P2),n_correct))

ans = 75149

7   Pass
%% P1 = [81343,-182804]; P2 = [83042,-182048]; n_correct = 1789; assert(isequal(divide_segment(P1,P2),n_correct))

ans = 1789

8   Pass
%% P1 = [418880,-37672]; P2 = [472348,556845]; n_correct = 356309290313; assert(isequal(divide_segment(P1,P2),n_correct))

ans = 3.5631e+11

Suggested Problems

More from this Author3

Community Treasure Hunt

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

Start Hunting!