CF66D.Petya and His Friends

普及+/提高

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

Little Petya has a birthday soon. Due this wonderful event, Petya's friends decided to give him sweets. The total number of Petya's friends equals to n.

Let us remind you the definition of the greatest common divisor: GCD(_a_1, ..., a__k) = d, where d represents such a maximal positive number that each a__i (1 ≤ i ≤ k) is evenly divisible by d. At that, we assume that all a__i's are greater than zero.

Knowing that Petya is keen on programming, his friends has agreed beforehand that the 1-st friend gives _a_1 sweets, the 2-nd one gives _a_2 sweets, ..., the n-th one gives a__n sweets. At the same time, for any i and j (1 ≤ i, j ≤ n) they want the GCD(a__i, a__j) not to be equal to 1. However, they also want the following condition to be satisfied: GCD(_a_1, _a_2, ..., a__n) = 1. One more: all the a__i should be distinct.

Help the friends to choose the suitable numbers _a_1, ..., a__n.

小佩佳的生日即将到来。为了庆祝这个美妙的时刻,佩佳的朋友们决定送他一些糖果。佩佳的朋友总共有 nn 位。

我们来回顾一下最大公约数(GCD)的定义:GCD(a1,…,ak)=d\mathrm{GCD}(a_1,\dots,a_k) = d,其中 dd 是满足对每个 aia_i(1≤i≤k1 \le i \le k)均有 d∣aid \mid a_i 的最大的正整数。这里我们假定所有 aia_i 均为正数。

由于佩佳热衷于编程,他的朋友们事先约定:第 11 位朋友送 a1a_1 颗糖果,第 22 位朋友送 a2a_2 颗糖果,……,第 nn 位朋友送 ana_n 颗糖果。同时,对任意 ii 和 jj(1≤i,j≤n1 \le i, j \le n),他们希望 GCD(ai,aj)≠1\mathrm{GCD}(a_i, a_j) \ne 1;但还要求满足条件:GCD(a1,a2,…,an)=1\mathrm{GCD}(a_1, a_2, \dots, a_n) = 1。此外,所有 aia_i 必须互不相同。

请帮助朋友们选出满足上述条件的数 a1,…,ana_1, \dots, a_n。

输入格式

The first line contains an integer n (2 ≤ n ≤ 50).

第一行包含一个整数 nn(2≤n≤502 \leq n \leq 50)。

输出格式

If there is no answer, print "-1" without quotes. Otherwise print a set of n distinct positive numbers _a_1, _a_2, ..., a__n. Each line must contain one number. Each number must consist of not more than 100 digits, and must not contain any leading zeros. If there are several solutions to that problem, print any of them.

Do not forget, please, that all of the following conditions must be true:

  • For every i and j (1 ≤ i, j ≤ n): GCD(a__i, a__j) ≠ 1
  • GCD(_a_1, _a_2, ..., a__n) = 1
  • For every i and j (1 ≤ i, j ≤ n, i ≠ j): a__i ≠ a__j

Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d).

如果无解,请输出 -1(不带引号)。否则,输出一组 nn 个互不相同的正整数 a1, a2, …, ana_1,\,a_2,\,\dots,\,a_n。每行输出一个数。每个数的十进制表示至多包含 100 位数字,且不能包含前导零。若存在多个满足条件的解,输出任意一个即可。

请注意,以下所有条件必须同时成立:

  • 对任意 ii 和 jj(1≤i,j≤n1\le i,j\le n):GCD(ai, aj)≠1\mathrm{GCD}(a_i,\,a_j)\ne 1;
  • GCD(a1, a2, …, an)=1\mathrm{GCD}(a_1,\,a_2,\,\dots,\,a_n)=1;
  • 对任意 ii 和 jj(1≤i,j≤n1\le i,j\le n 且 i≠ji\ne j):ai≠aja_i\ne a_j。

请注意,在 C++ 中读写 64 位整数时,请勿使用 %lld 格式说明符;推荐使用 cout(也可使用 %I64d)。

输入输出样例

  • 输入#1

    3

    输出#1

    99
    55
    11115
  • 输入#2

    4

    输出#2

    385
    360
    792
    8360

输入解题思路,AI测评打分。不知道怎么写?

首页