#P5736. 【深基7.例2】质数筛
【深基7.例2】质数筛
Problem Description
Input positive integers, each not greater than . Store them all in an array, remove the numbers that are not prime, and output the remaining primes in order.
Input Format
The first line contains a positive integer , indicating the number of integers.
The second line contains positive integers , separated by spaces.
Output Format
Output one line: print the remaining primes in in order, separated by spaces.
5
3 4 5 6 7
3 5 7
Hint
Constraints: , .
Translated by ChatGPT 5