Cody

Problem 1103. Right Triangle Side Lengths (Inspired by Project Euler Problem 39)

Solution 1953573

Submitted on 30 Sep 2019 by Ngo Quang Hien
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
assert(isequal(right_triangle_sides(240),{ [15 112 113] [40 96 104] [48 90 102] [60 80 100] }))

answer = 0×0 empty cell array aa = 15 cc = 113 aa = 40 cc = 104 aa = 48 cc = 102 aa = 60 cc = 100 aa = 60 cc = 100 aa = 48 cc = 102 aa = 40 cc = 104 aa = 15 cc = 113

2   Pass
assert(isequal(right_triangle_sides(240),{ [15 112 113] [40 96 104] [48 90 102] [60 80 100] }))

answer = 0×0 empty cell array aa = 15 cc = 113 aa = 40 cc = 104 aa = 48 cc = 102 aa = 60 cc = 100 aa = 60 cc = 100 aa = 48 cc = 102 aa = 40 cc = 104 aa = 15 cc = 113

3   Pass
assert(isequal(right_triangle_sides(418),{ [57 176 185] }))

answer = 0×0 empty cell array aa = 57 cc = 185 aa = 57 cc = 185

4   Pass
assert(isequal(right_triangle_sides(490),{ [140 147 203] }))

answer = 0×0 empty cell array aa = 140 cc = 203 aa = 140 cc = 203

5   Pass
assert(isequal(right_triangle_sides(112),{ [14 48 50] }))

answer = 0×0 empty cell array aa = 14 cc = 50 aa = 14 cc = 50

6   Pass
assert(isequal(right_triangle_sides(390),{ [52 165 173] [65 156 169] }))

answer = 0×0 empty cell array aa = 52 cc = 173 aa = 65 cc = 169 aa = 65 cc = 169 aa = 52 cc = 173

7   Pass
assert(isequal(right_triangle_sides(132),{ [11 60 61] [33 44 55] }))

answer = 0×0 empty cell array aa = 11 cc = 61 aa = 33 cc = 55 aa = 33 cc = 55 aa = 11 cc = 61

8   Pass
assert(isequal(right_triangle_sides(576),{ [64 252 260] [144 192 240] }))

answer = 0×0 empty cell array aa = 64 cc = 260 aa = 144 cc = 240 aa = 144 cc = 240 aa = 64 cc = 260

9   Pass
assert(isequal(right_triangle_sides(60),{ [10 24 26] [15 20 25] }))

answer = 0×0 empty cell array aa = 10 cc = 26 aa = 15 cc = 25 aa = 15 cc = 25 aa = 10 cc = 26

10   Pass
assert(isequal(right_triangle_sides(650),{ [25 312 313] }))

answer = 0×0 empty cell array aa = 25 cc = 313 aa = 25 cc = 313

11   Pass
assert(isequal(right_triangle_sides(732),{ [183 244 305] }))

answer = 0×0 empty cell array aa = 183 cc = 305 aa = 183 cc = 305

12   Pass
assert(isequal(right_triangle_sides(648),{ [162 216 270] }))

answer = 0×0 empty cell array aa = 162 cc = 270 aa = 162 cc = 270

13   Pass
assert(isequal(right_triangle_sides(930),{ [155 372 403] }))

answer = 0×0 empty cell array aa = 155 cc = 403 aa = 155 cc = 403

14   Pass
assert(isequal(right_triangle_sides(876),{ [219 292 365] }))

answer = 0×0 empty cell array aa = 219 cc = 365 aa = 219 cc = 365

15   Pass
assert(isequal(right_triangle_sides(588),{ [84 245 259] [147 196 245] }))

answer = 0×0 empty cell array aa = 84 cc = 259 aa = 147 cc = 245 aa = 147 cc = 245 aa = 84 cc = 259

16   Pass
assert(isequal(right_triangle_sides(208),{ [39 80 89] }))

answer = 0×0 empty cell array aa = 39 cc = 89 aa = 39 cc = 89

17   Pass
assert(isequal(right_triangle_sides(228),{ [57 76 95] }))

answer = 0×0 empty cell array aa = 57 cc = 95 aa = 57 cc = 95

18   Pass
assert(isequal(right_triangle_sides(312),{ [24 143 145] [78 104 130] }))

answer = 0×0 empty cell array aa = 24 cc = 145 aa = 78 cc = 130 aa = 78 cc = 130 aa = 24 cc = 145

19   Pass
assert(isequal(right_triangle_sides(924),{ [42 440 442] [77 420 427] [132 385 407] [198 336 390] [231 308 385] }))

answer = 0×0 empty cell array aa = 42 cc = 442 aa = 77 cc = 427 aa = 132 cc = 407 aa = 198 cc = 390 aa = 231 cc = 385 aa = 231 cc = 385 aa = 198 cc = 390 aa = 132 cc = 407 aa = 77 cc = 427 aa = 42 cc = 442

20   Pass
assert(isequal(right_triangle_sides(980),{ [280 294 406] }))

answer = 0×0 empty cell array aa = 280 cc = 406 aa = 280 cc = 406

21   Pass
assert(isequal(right_triangle_sides(112),{ [14 48 50] }))

answer = 0×0 empty cell array aa = 14 cc = 50 aa = 14 cc = 50

22   Pass
assert(isequal(right_triangle_sides(30),{ [5 12 13] }))

answer = 0×0 empty cell array aa = 5 cc = 13 aa = 5 cc = 13

23   Pass
assert(isequal(right_triangle_sides(680),{ [102 280 298] [136 255 289] }))

answer = 0×0 empty cell array aa = 102 cc = 298 aa = 136 cc = 289 aa = 136 cc = 289 aa = 102 cc = 298

24   Pass
assert(isequal(right_triangle_sides(396),{ [33 180 183] [72 154 170] [99 132 165] }))

answer = 0×0 empty cell array aa = 33 cc = 183 aa = 72 cc = 170 aa = 99 cc = 165 aa = 99 cc = 165 aa = 72 cc = 170 aa = 33 cc = 183

25   Pass
assert(isequal(right_triangle_sides(988),{ [266 312 410] }))

answer = 0×0 empty cell array aa = 266 cc = 410 aa = 266 cc = 410

Suggested Problems

More from this Author56

Community Treasure Hunt

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

Start Hunting!