Different solutions for an easy problem

Revision en1, by ScienceGuy, 2017-03-04 15:36:40

Hi, I just solved a problem "Fency Fence" (problem: http://mirror.codeforces.com/problemset/problem/270/A) My solution is as follows: 1. Create the set of the angles, which have an integer value and are the angles of regular polygons (size of polygons: min 3, maximum 100,000, because after that the angle alpha satisfies the next condition: 179 < alpha < 180); 2. Check if the input angle is in our given set. Link of my submission: http://mirror.codeforces.com/contest/270/submission/25210820 My code got accepted, but it made me think of a different kind of problem: what if the input was a double? How would you solve it? Is there a special mathematical property to calculate the angle of an arbitrary regular polygon?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English ScienceGuy 2017-03-04 15:38:32 45
en3 English ScienceGuy 2017-03-04 15:37:51 6 Tiny change: 'is in our given set.\nLin' -> 'is in our set.\nLin'
en2 English ScienceGuy 2017-03-04 15:36:58 1 Tiny change: 'lem/270/A)\nMy solut' -> 'lem/270/A).\nMy solut'
en1 English ScienceGuy 2017-03-04 15:36:40 752 Initial revision (published)