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

6638번 - Peculiar Primes 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB20151575.000%

문제

The level of corruption in some countries is really high. It is hard to imagine that these unethical manners have already hit the academic field. Some rumors are spreading that some students tried to bribe their lecturers to get better grades. Would you believe it?

But the real situation may be even much worse. ACM has a very strong suspicion that somebody has bribed mathematicians in the Academy of Sciences in order to forge some of their results. In particular, it is suspected that a very influential person wants to prefer some prime numbers over others.

It is said that many mathematicians have already completely stopped using some primes and they create only those numbers that can be “assembled” without those primes. Your task is to verify this hypothesis.

Given a set of prime numbers, your program should output all integer numbers that can be created solely by multiplying these primes, without using any other primes.

입력

The input will consist of several test scenarios. Each scenario starts by a line with a single positive integer N (1≤N≤10) — the number of primes in the set.

On the second line of a scenario, there are N integer numbers 2 ≤ P1 < P2 < P3 <... <PN < 10000, separated by a space. You are guaranteed that all these numbers are prime. On the third line of each scenario, there are 2 integers X and Y (1 ≤ X ≤ Y < 231), separated by a space.

The last scenario is followed by a line containing single zero.

출력

Your task is to print all positive integer numbers in the closed interval [X, Y] that have no other prime factors than those given in the input (Pi). Print all such numbers in the increasing order, with no duplicates and separated by a single comma character (“,”). If there are no such numbers, print the word “none” instead.

Note that the number 1 does not need any primes to be constructed and is therefore always allowed.

제한

예제 입력 1

1
3
1 12
2
2 3
10 20
3
2 3 5
20 30
1
17
20 30
0

예제 출력 1

1,3,9
12,16,18
20,24,25,27,30
none

힌트

출처

ICPC > Regionals > Europe > Central European Regional Contest > CTU Open Contest > CTU Open Contest 2009 P번

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

출처

대학교 대회

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

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