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

문제

Nora Mainder has a game she plays with her students to help them learn multiplication. She calls out a sequence of numbers and the students have to determine when she names a whole number multiple of the first number. When a student recognizes such a multiple, he or she must call out “Mult!”, ending this round of the game. Then a new round begins with a new initial number. Fortunately her students are very bright and never fail to recognize a multiple, so they all cry out at once—a “multitude” of shouts.

For instance, if she calls out “$8$, $3$, $12$, $6$, $24$,” her students all yell “Mult!” when she reaches $24$ because it is a multiple of the first number, $8$. If she begins a second round of the game with the sequence “$14$, $12$, $9$, $70$,” the class will call out “Mult!” when she reaches $70$, a multiple of the first number, $14$.

Given a sequence of numbers called out by Nora during several rounds of the game, identify which numbers ought to produce a shout of “Mult!”

입력

The first line of input contains an integer $n$, $2 ≤ n ≤ 1\,000$, the length of the number sequence. The following $n$ lines contains the sequence, one number per line. All numbers in the sequence are positive integers less than or equal to $100$. The sequence is guaranteed to contain at least one complete round of the game (but may end with an incomplete round).

출력

Print all of the sequence elements that will cause the class to shout “Mult!” Each value should be printed on a separate line.

예제 입력 1

10
8
3
12
6
24
14
12
9
70
5

예제 출력 1

24
70

예제 입력 2

5
3
3
2
5
7

예제 출력 2

3

출처

ICPC > Regionals > North America > North America Qualification Contest > ICPC North America Qualifier 2021 H번

  • 문제를 만든 사람: Bob Roos