您的位置:首页 > 其它

Codeforces Round #319 (Div. 2) C. Vasya and Petya's Game

2015-09-20 12:47 816 查看

题目链接

http://codeforces.com/contest/577/problem/C

Description

Vasya and Petya are playing a simple game. Vasya thought of number x between 1 and n, and Petya tries to guess the number.

Petya can ask questions like: “Is the unknown number divisible by number y?”.

The game is played by the following rules: first Petya asks all the questions that interest him (also, he can ask no questions), and then Vasya responds to each question with a ‘yes’ or a ‘no’. After receiving all the answers Petya should determine the number that Vasya thought of.

Unfortunately, Petya is not familiar with the number theory. Help him find the minimum number of questions he should ask to make a guaranteed guess of Vasya’s number, and the numbers yi, he should ask the questions about.

Input

A single line contains number n (1 ≤ n ≤ 103).

Output

Print the length of the sequence of questions k (0 ≤ k ≤ n), followed by k numbers — the questions yi (1 ≤ yi ≤ n).

If there are several correct sequences of questions of the minimum length, you are allowed to print any of them.

Sample test(s)

input

4

output

3

2 4 3

input

6

output

4

2 4 3 5

HINT

题意

找数游戏

规则是一个数i,告诉你这个数是不是i的倍数。现在给一个整数N,让你给一个序列可以确定小于等于N的任意数字。

题解

序列中一定会有的数字有质数的k次方(k>=1),其他的数字都可以根据自己的因子推处理。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  codeforces