D. Petya and His Friends
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

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(a1, ..., ak) = d, where d represents such a maximal positive number that each ai (1 ≤ i ≤ k) is evenly divisible by d. At that, we assume that all ai's are greater than zero.

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

Help the friends to choose the suitable numbers a1, ..., an.

Input

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

Output

If there is no answer, print "-1" without quotes. Otherwise print a set of n distinct positive numbers a1, a2, ..., an. 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(ai, aj) ≠ 1
  • GCD(a1, a2, ..., an) = 1
  • For every i and j (1 ≤ i, j ≤ n, i ≠ j): ai ≠ aj

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).

Examples
Input
3
Output
99
55
11115
Input
4
Output
385
360
792
8360
题意:满足这三个条件,否则输出-1;
  • For every i and j (1 ≤ i, j ≤ n): GCD(ai, aj) ≠ 1
  • GCD(a1, a2, ..., an) = 1
  • For every i and j (1 ≤ i, j ≤ n, i ≠ j): ai ≠ aj

 思路:2显然-1;

    先找到一个3满足的条件,然后输出一个数的倍数即可;注意不要重复;

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define esp 1e-13
const int N=1e4+,M=1e6+,inf=1e9+,mod=;
int main()
{
int x,y,i,z,t;
scanf("%d",&x);
if(x==)
printf("-1");
else
{
printf("6\n10\n15\n");
for(int i=,t=;i<x-;i++,t++)
printf("%d\n",*t);
}
return ;
}

  

Codeforces Beta Round #61 (Div. 2) D. Petya and His Friends 想法的更多相关文章

  1. Codeforces Beta Round #61 (Div. 2)

    Codeforces Beta Round #61 (Div. 2) http://codeforces.com/contest/66 A 输入用long double #include<bit ...

  2. Codeforces Beta Round #57 (Div. 2)

    Codeforces Beta Round #57 (Div. 2) http://codeforces.com/contest/61 A #include<bits/stdc++.h> ...

  3. Codeforces Beta Round #80 (Div. 2 Only)【ABCD】

    Codeforces Beta Round #80 (Div. 2 Only) A Blackjack1 题意 一共52张扑克,A代表1或者11,2-10表示自己的数字,其他都表示10 现在你已经有一 ...

  4. Codeforces Beta Round #83 (Div. 1 Only)题解【ABCD】

    Codeforces Beta Round #83 (Div. 1 Only) A. Dorm Water Supply 题意 给你一个n点m边的图,保证每个点的入度和出度最多为1 如果这个点入度为0 ...

  5. Codeforces Beta Round #79 (Div. 2 Only)

    Codeforces Beta Round #79 (Div. 2 Only) http://codeforces.com/contest/102 A #include<bits/stdc++. ...

  6. Codeforces Beta Round #77 (Div. 2 Only)

    Codeforces Beta Round #77 (Div. 2 Only) http://codeforces.com/contest/96 A #include<bits/stdc++.h ...

  7. Codeforces Beta Round #76 (Div. 2 Only)

    Codeforces Beta Round #76 (Div. 2 Only) http://codeforces.com/contest/94 A #include<bits/stdc++.h ...

  8. Codeforces Beta Round #75 (Div. 2 Only)

    Codeforces Beta Round #75 (Div. 2 Only) http://codeforces.com/contest/92 A #include<iostream> ...

  9. Codeforces Beta Round #74 (Div. 2 Only)

    Codeforces Beta Round #74 (Div. 2 Only) http://codeforces.com/contest/90 A #include<iostream> ...

随机推荐

  1. Linux 进程间通信(二)(网络IPC:套接字)

    socket描述符 套接字是通信端点的抽象,创建一个套接字使用如下函数: #include <sys/socket.h> int socket(int domain, int type, ...

  2. #1589 : 回文子串的数量(Manacher)

    #1589 : 回文子串的数量 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 给定一个字符串S,请统计S的所有|S| * (|S| + 1) / 2个子串中(首尾位置不 ...

  3. Travel(最短路)

    Travel The country frog lives in has nn towns which are conveniently numbered by 1,2,…,n1,2,…,n. Amo ...

  4. tomcat8热部署配置--maven自动发布项目到tomcat8(如何支持远程访问部署)

    1.tomcat8实现热部署的配置  我们实现热部署后,自然就可以通过maven操作tomcat了,所以就需要maven取得操作tomcat的权限,现在这一步就是配置tomcat的可操作权限. #进入 ...

  5. entropy 压缩信息的熵更加高 实际上英文文本的熵大概只有4.7比特

    https://en.wikipedia.org/wiki/Entropy_(information_theory) https://zh.wikipedia.org/wiki/熵(信息论) 熵的概念 ...

  6. Echarts-雷达图

    // 显示能力雷达图 $(".company .grade").hover(function () { $(".powerChart").show(); var ...

  7. Django的admin定制

    1,models编写 #encoding=utf-8 from django.db import models # Create your models here. class BookInfo(mo ...

  8. python模块学习(二)

    configparser模块 软件常见文档格式如下: [DEFAULT]ServerAliveInterval = 45Compression = yesCompressionLevel = 9For ...

  9. python基础:while循环,for循环

    ---恢复内容开始--- 1.使用while循环输出1 2 3 4 5 6     8 9 10 2.求1-100的所有数的和 3.输出 1-100 内的所有奇数 4.输出 1-100 内的所有偶数 ...

  10. 关于服务器jdk版本和代码编译调试兼容问题

    首先代码是基于哪个版本编写和调试,有没有用到新版本jdk新的特性,类啊接口啊啥的,用到了的话,就不行了 其他都共有的是向下兼容的 最好开发环境的jdk版本和部署环境的jdk版本匹配.