Problem 44817. Wrecked Angles?

Solution 1702003

Submitted on 3 Jan 2019 by Tim
  • Size: 17
  • This is the leading solution.
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
P=14; A=12; y=wrecked_angles(P,A); y_correct = 20.63495408493621; junk=abs(y-y_correct); assert(junk-1<1e-10);

2   Pass
P=34; A=60; y=wrecked_angles(P,A); y_correct = 131.7322896141688; junk=abs(y-y_correct); assert(junk-1<1e-10);

3   Pass
P=62; A=168; y=wrecked_angles(P,A); y_correct = 590.8738521234052; junk=abs(y-y_correct); assert(junk-100<1e-10);

4   Pass
s1=100; totalsum=zeros(1,s1); for s2=1:s1 P=2*(s1+s2); A=s1*s2; totalsum(s2)=wrecked_angles(P,A); end s=sum(totalsum); s_correct=1051137.631982975; s_junk=abs(s-s_correct); assert(s_junk<1e-8); d=max(totalsum)-min(totalsum); d_correct=7853.196235811095; d_junk=abs(d-d_correct); assert(d_junk<1e-8);

5   Pass
s1=wrecked_angles(32,64); s2=wrecked_angles(72,288); P=2*(s1+s2); A=s1*s2; y=wrecked_angles(P,A); y_correct=259088.4479405854; junk=abs(y-y_correct); assert(junk<1e-10);