A7968 | Petya and His Friends
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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}$ .
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}$ .
输入格式
The first line contains an integer $n$ ( $2<=n<=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).
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
3
输出 #1
99 55 11115
输入 #2
4
输出 #2
385 360 792 8360
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted