Logo
(追記) (追記ここまで)

27590번 - Sun and Moon 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB162996389161.027%

문제

You recently missed an eclipse and are waiting for the next one! To see any eclipse from your home, the sun and the moon must be in alignment at specific positions. You know how many years ago the sun was in the right position, and how many years it takes for it to get back to that position. You know the same for the moon. When will you see the next eclipse?

입력

The input consists of two lines.

The first line contains two integers, $d_s$ and $y_s$ $(0 \le d_s < y_s \le 50),ドル where $d_s$ is how many years ago the sun was in the right position, and $y_s$ is how many years it takes for the sun to be back in that position.

The second line contains two integers, $d_m$ and $y_m$ $(0 \le d_m < y_m \le 50),ドル where $d_m$ is how many years ago the moon was in the right position, and $y_m$ is how many years it takes for the moon to be back in that position.

출력

Output a single integer, the number of years until the next eclipse. The data will be set in such a way that there is not an eclipse happening right now and there will be an eclipse within the next 5ドル,000円$ years.

제한

예제 입력 1

3 10
1 2

예제 출력 1

7

힌트

출처

ICPC > Regionals > North America > Mid-Atlantic Regional > 2022 Mid-Atlantic USA Regional Contest > Division 2 H번

ICPC > Regionals > North America > South Central USA Regional > 2022 South Central USA Regional Contest > Division 2 H번

ICPC > Regionals > North America > Southeast USA Regional > 2022 Southeast USA Regional Programming Contest > Division 2 H번

ICPC > Regionals > North America > North Central North America Regional > 2022 North Central NA Regional Contest E번

ICPC > Regionals > North America > Pacific Northwest Regional > 2022 ICPC Pacific Northwest Region > Division 1 J번

ICPC > Regionals > North America > Pacific Northwest Regional > 2022 ICPC Pacific Northwest Region > Division 2 J번

ICPC > Regionals > North America > Rocky Mountain Regional > 2022 Rocky Mountain Regional Contest J번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /