ScienceGuy's blog

By ScienceGuy, history, 8 years ago, In English

Hi, I just solved a problem "Fency Fence" (problem: http://codeforces.net/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://codeforces.net/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?

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?