Блог пользователя ScienceGuy

Автор ScienceGuy, история, 8 лет назад, По-английски

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

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится