CF576A.Vasya and Petya's Game

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Vasya and Petya are playing a simple game. Vasya thought of number xx between 11 and nn , and Petya tries to guess the number.

Petya can ask questions like: "Is the unknown number divisible by number yy ?".

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 yiy_{i} , he should ask the questions about.

输入格式

A single line contains number nn ( 1<=n<=1031<=n<=10^{3} ).

输出格式

Print the length of the sequence of questions kk ( 0<=k<=n0<=k<=n ), followed by kk numbers — the questions yiy_{i} ( 1<=yi<=n1<=y_{i}<=n ).

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

输入输出样例

  • 输入#1

    4
    

    输出#1

    3
    2 4 3 
    
  • 输入#2

    6
    

    输出#2

    4
    2 4 3 5 
    

说明/提示

The sequence from the answer to the first sample test is actually correct.

If the unknown number is not divisible by one of the sequence numbers, it is equal to 11 .

If the unknown number is divisible by 44 , it is 44 .

If the unknown number is divisible by 33 , then the unknown number is 33 .

Otherwise, it is equal to 22 . Therefore, the sequence of questions allows you to guess the unknown number. It can be shown that there is no correct sequence of questions of length 2 or shorter.

首页