Cody

Solution 2131267

Submitted on 17 Feb 2020 by Nikolaos Nikolaou
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
x = 1; y1 = fifth_times_a_charm(x); assert(~isequal(y1,x)) y2 = fifth_times_a_charm(x); assert(~isequal(y2,x)) assert(abs(x-y2)<abs(x-y1)) y3 = fifth_times_a_charm(x); assert(~isequal(y3,x)) assert(abs(x-y3)<abs(x-y2)) y4 = fifth_times_a_charm(x); assert(~isequal(y4,x)) assert(abs(x-y4)<abs(x-y3)) y5 = fifth_times_a_charm(x); assert(isequal(y5,x))

q = 1 l = 21 16 11 6 1 y = 21 q = 2 l = 21 16 11 6 1 y = 16 q = 3 l = 21 16 11 6 1 y = 11 q = 4 l = 21 16 11 6 1 y = 6 q = 5 l = 21 16 11 6 1 y = 1 q = 0

2   Pass
x = -1; y1 = fifth_times_a_charm(x); assert(~isequal(y1,x)) y2 = fifth_times_a_charm(x); assert(~isequal(y2,x)) assert(abs(x-y2)<abs(x-y1)) y3 = fifth_times_a_charm(x); assert(~isequal(y3,x)) assert(abs(x-y3)<abs(x-y2)) y4 = fifth_times_a_charm(x); assert(~isequal(y4,x)) assert(abs(x-y4)<abs(x-y3)) y5 = fifth_times_a_charm(x); assert(isequal(y5,x))

q = 1 l = 19 14 9 4 -1 y = 19 q = 2 l = 19 14 9 4 -1 y = 14 q = 3 l = 19 14 9 4 -1 y = 9 q = 4 l = 19 14 9 4 -1 y = 4 q = 5 l = 19 14 9 4 -1 y = -1 q = 0

3   Pass
x = 42; y1 = fifth_times_a_charm(x); assert(~isequal(y1,x)) y2 = fifth_times_a_charm(x); assert(~isequal(y2,x)) assert(abs(x-y2)<abs(x-y1)) y3 = fifth_times_a_charm(x); assert(~isequal(y3,x)) assert(abs(x-y3)<abs(x-y2)) y4 = fifth_times_a_charm(x); assert(~isequal(y4,x)) assert(abs(x-y4)<abs(x-y3)) y5 = fifth_times_a_charm(x); assert(isequal(y5,x))

q = 1 l = 62 57 52 47 42 y = 62 q = 2 l = 62 57 52 47 42 y = 57 q = 3 l = 62 57 52 47 42 y = 52 q = 4 l = 62 57 52 47 42 y = 47 q = 5 l = 62 57 52 47 42 y = 42 q = 0

4   Pass
x = i; y1 = fifth_times_a_charm(x); assert(~isequal(y1,x)) y2 = fifth_times_a_charm(x); assert(~isequal(y2,x)) assert(abs(x-y2)<abs(x-y1)) y3 = fifth_times_a_charm(x); assert(~isequal(y3,x)) assert(abs(x-y3)<abs(x-y2)) y4 = fifth_times_a_charm(x); assert(~isequal(y4,x)) assert(abs(x-y4)<abs(x-y3)) y5 = fifth_times_a_charm(x); assert(isequal(y5,x))

q = 1 l = 0.0000 +11.0000i 0.0000 + 5.0000i 0.0000 + 4.0000i 0.0000 + 3.0000i 0.0000 + 1.0000i y = 0.0000 +11.0000i q = 2 l = 0.0000 +11.0000i 0.0000 + 5.0000i 0.0000 + 4.0000i 0.0000 + 3.0000i 0.0000 + 1.0000i y = 0.0000 + 5.0000i q = 3 l = 0.0000 +11.0000i 0.0000 + 5.0000i 0.0000 + 4.0000i 0.0000 + 3.0000i 0.0000 + 1.0000i y = 0.0000 + 4.0000i q = 4 l = 0.0000 +11.0000i 0.0000 + 5.0000i 0.0000 + 4.0000i 0.0000 + 3.0000i 0.0000 + 1.0000i y = 0.0000 + 3.0000i q = 5 l = 0.0000 +11.0000i 0.0000 + 5.0000i 0.0000 + 4.0000i 0.0000 + 3.0000i 0.0000 + 1.0000i y = 0.0000 + 1.0000i q = 0