Perfect Permutation
来源:互联网 发布:淘宝整点秒杀是真的吗 编辑:程序博客网 时间:2024/06/07 05:22
Description
A permutation is a sequence of integers p1, p2, ..., pn, consisting ofn distinct positive integers, each of them doesn't exceedn. Let's denote the i-th element of permutation p aspi. We'll call numbern the size of permutation p1, p2, ..., pn.
Nickolas adores permutations. He likes some permutations more than the others. He calls such permutations perfect. Aperfect permutation is such permutation p that for any i (1 ≤ i ≤ n) (n is the permutation size) the following equations holdppi = i andpi ≠ i. Nickolas asks you to print any perfect permutation of sizen for the given n.
Input
A single line contains a single integern (1 ≤ n ≤ 100) — the permutation size.
Output
If a perfect permutation of sizen doesn't exist, print a single integer -1. Otherwise printn distinct integers from 1 to n, p1, p2, ..., pn — permutationp, that is perfect. Separate printed numbers by whitespaces.
Sample Input
1
-1
2
2 1
4
2 1 4 3
Sample Output
102410240792
Note
In the second sample, if Alice doesn't pick any mushrooms from the 5-th mountain. She can give (512+512+0)=1024 grams of mushrooms to Sunny, Lunar and Star. Marisa won't steal any mushrooms from her as she has exactly 1 kilograms of mushrooms in total.
In the third sample, there are no three bags whose total weight is of integral kilograms. So Alice must leave all the five bags and enter the forest with no mushrooms.
In the last sample:
- Giving Sunny, Lunar and Star: (208+308+508)=1024
- Stolen by Marisa: ((708+1108)-1024)=792
Hint
真心没看懂意思。。。。。。。
#include<stdio.h> int main() { int n; int i,j; scanf("%d",&n); if(n%2==1) printf("-1\n"); else { for(i=1;i<=n/2;i++) { printf("%d %d ",i*2,i*2-1); } printf("\n"); } return 0; }
- Perfect Permutation
- Perfect Permutation
- A. Perfect Permutation
- 【Poj2825】Perfect Permutation 构造
- 233A. Perfect Permutation
- Codeforces-233A Perfect Permutation
- CodeForces 233A Perfect Permutation
- Codeforces 233A-Perfect Permutation(规律)
- 7_13_J题 Perfect Permutation(构造)
- Codeforces Round #144 (Div. 2)---A. Perfect Permutation
- Codeforces 233A Perfect Permutation(完美序列,水题)
- "Perfect"
- Permutation
- Permutation
- permutation
- Permutation
- Permutation
- Permutation
- 心得3--打包web应用 war 与 Tomcat服务器的管理平台
- Oracle EBS R12 - 一段Oracle EBS中给指定用户增加指定职责的PLSQL脚本
- Android中自定义Activity和Dialog的位置大小背景和透明度等
- 垂直同步之谜 XP/Vista与3D性能测试
- There is no ID/IDREF binding for IDREF
- Perfect Permutation
- 树状数组
- 男人凭什么三十而立——用好自己的钱
- php 数字转换时间
- Android SDCard的容量大小
- java算法每日一练
- source insight配置
- android.widget.ImageView用法详解
- Spring AOP 的 Hello World