Different solutions for an easy problem

Правка en4, от ScienceGuy, 2017-03-04 15:38:32

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 set and output YES or NO based on this. Finished. 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?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en4 Английский ScienceGuy 2017-03-04 15:38:32 45
en3 Английский ScienceGuy 2017-03-04 15:37:51 6 Tiny change: 'is in our given set.\nLin' -> 'is in our set.\nLin'
en2 Английский ScienceGuy 2017-03-04 15:36:58 1 Tiny change: 'lem/270/A)\nMy solut' -> 'lem/270/A).\nMy solut'
en1 Английский ScienceGuy 2017-03-04 15:36:40 752 Initial revision (published)