| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 29 | 18 | 13 | 54.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.
5 7 9 1
1
2 3 4 7
19
School > CS@Mines > CS@Mines HSPC 2019 C번