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

34438번 - Classrooms and Calculators 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB29181354.167%

문제

You're trying to organize a group of yourself and 3ドル$ friends to play a campaign of your favorite tabletop game, Classrooms & Calculators. Your schedule is free every day, but your friends all have some scheduling conflicts. Let today be day 0ドル,ドル tomorrow be day 1ドル,ドル etc. Your first friend can't play today or every $d_1$ days after today, your second friend can't play today or every $d_2$ days after today, and your third friend can't play today or every $d_3$ days after today. You can only play on a day if nobody has a conflict, and you always play on days with no conflicts. For example, if $d_1 = 3,ドル $d_2 = 4,ドル and $d_3 = 5,ドル in the first 10ドル$ days you would play on days 1ドル,ドル 2ドル,ドル and 7ドル,ドル but not on days 0ドル,ドル 3ドル,ドル 4ドル,ドル 5ドル,ドル 6ドル,ドル 8ドル,ドル 9ドル,ドル and 10ドル$.

Your campaign's Classroom Teacher has told you that it will take $n$ days of playing to complete the campaign; can you determine the number of the day you finish the campaign?

입력

The first line of the input contains the values of $d_1, d_2,ドル and $d_3$ (each between 2ドル$ and 50ドル,ドル inclusive), each separated by a single space, describing your friends' schedule conflicts. The second line contains $n,ドル the number of days you will need to play on to complete the campaign $(1 \le n \le 5\cdot10^8)$.

You are guaranteed that the values of $d_1,ドル $d_2,ドル and $d_3$ are such that you can complete the campaign in finite time.

출력

You should output a single number, the number of the day on which you finish the campaign.

제한

예제 입력 1

5 7 9
1

예제 출력 1

1

예제 입력 2

2 3 4
7

예제 출력 2

19

노트

출처

School > CS@Mines > CS@Mines HSPC 2019 C번

  • 문제를 만든 사람: Matt Iverson
(追記) (追記ここまで)

출처

대학교 대회

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

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