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

10104번 - Party Invitation 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB66242134668.651%

문제

You are hosting a party and do not have room to invite all of your friends. You use the following unemotional mathematical method to determine which friends to invite.

Number your friends 1, 2, . . . , K and place them in a list in this order. Then perform m rounds. In each round, use a number to determine which friends to remove from the ordered list.

The rounds will use numbers r1, r2, . . . , rm. In round i remove all the remaining people in positions that are multiples of ri (that is, ri, 2ri, 3ri, . . .) The beginning of the list is position 1.

Output the numbers of the friends that remain after this removal process.

입력

The first line of input contains the integer K (1 ≤ K ≤ 100). The second line of input contains the integer m (1 ≤ m ≤ 10), which is the number of rounds of removal. The next m lines each contain one integer. The ith of these lines (1 ≤ i ≤ m) contains ri (2 ≤ ri ≤ 100) indicating that every person at a position which is multiple of ri should be removed.

출력

The output is the integers assigned to friends who were not removed. One integer is printed per line in increasing sorted order.

제한

예제 입력 1

10
2
2
3

예제 출력 1

1
3
7
9

힌트

출처

Olympiad > Canadian Computing Competition & Olympiad > 2014 > CCC 2014 Junior Division 4번

Olympiad > Canadian Computing Competition & Olympiad > 2014 > CCC 2014 Senior Division 1번

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

출처

대학교 대회

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

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