Laser Beam

시간 제한1초메모리 제한1024 MB

요약
두 거울이 이루는 각 alpha와 입사각 beta가 주어질 때, 빛이 무한히 멀어지기 전까지 반사되는 횟수를 구한다.
난이도

보통10점 중 7점

유형
기하, 수학, 정수론, 구현
정답자
아직 제출이 없습니다

문제

There are two infinite flat mirrors located at an angle α\alpha relative to each other so that they can be considered as rays on the plane when viewed from the side. Through a tiny hole in one of the mirrors, a laser beam is launched at an angle β\beta as shown in the figure below:

Your task is to count the number of reflections of the laser beam from the mirrors before it goes to infinity. The angle of incidence of the beam on the mirror always coincides with the angle of reflection. The hole through which the beam is launched is extremely small, so we can assume that if the beam suddenly hits the hole, it will still be completely reflected according to the usual rules.

입력

Given two integers α\alpha and β\beta --- angles given in degrees (1≤α≤1791 \le \alpha \le 179, 1≤β≤1791 \le \beta \le 179).

출력

Print one integer --- the number of reflections.

힌트

In the first example, the beam is reflected as follows:

예제3

  1. 예제 1

    입력
    30 35
    
    예상 출력
    4
    
  2. 예제 2

    입력
    90 90
    
    예상 출력
    0
    
  3. 예제 3

    입력
    30 60
    
    예상 출력
    3