hdu 361B
#include<stdio.h>
int a[100100];
int main() {
int n,i,k;
while(scanf("%d%d",&n,&k)!=EOF) {
if(k==n) {
printf("-1\n");
continue;
}
for(i=2;i<=k+1;i++)
a[i]=i;
for(i=k+3;i<=n;i+=2) {
a[i]=i-1;
a[i-1]=i;
}
if(i-1==n) {
a[1]=n;
a[n]=1;
}
else
a[1]=1;
printf("%d",a[1]);
for(i=2;i<=n;i++)
printf(" %d",a[i]);
printf("\n");
}
return 0;
}
hdu 361B的更多相关文章
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
- HDU 4569 Special equations(取模)
Special equations Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 4006The kth great number(K大数 +小顶堆)
The kth great number Time Limit:1000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64 ...
- HDU 1796How many integers can you find(容斥原理)
How many integers can you find Time Limit:5000MS Memory Limit:32768KB 64bit IO Format:%I64d ...
- hdu 4481 Time travel(高斯求期望)(转)
(转)http://blog.csdn.net/u013081425/article/details/39240021 http://acm.hdu.edu.cn/showproblem.php?pi ...
- HDU 3791二叉搜索树解题(解题报告)
1.题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=3791 2.参考解题 http://blog.csdn.net/u013447865/articl ...
- hdu 4329
problem:http://acm.hdu.edu.cn/showproblem.php?pid=4329 题意:模拟 a. p(r)= R'/i rel(r)=(1||0) R ...
随机推荐
- Oracle报错:"ORA-18008: 无法找到 OUTLN 方案 "的解决方案
Oracle报错:"ORA-18008: 无法找到 OUTLN 方案 "的解决方案 今天连接到Oracle报错:ORA-18008: 无法找到 OUTLN 方案,前天还用得 ...
- Spirng MVC +Velocity 表单绑定命令对象
通常,表单中的数据在提交之后可以通过Spring MVC的@RequestParam注解在控制器函数的参数列表中中提取出来,但是一旦表单数据过多的话,参数列表将会变得非常长,最好的解决方案是将表单中的 ...
- 转】在Ubuntu中安装Cassandra
原博文出自于: http://blog.fens.me/category/%E6%95%B0%E6%8D%AE%E5%BA%93/ 感谢! Posted: Mar 22, 2014 Tags: cas ...
- Java-超市购物小票案例-详细介绍
1.1 超市购物购物小票需求分析 用户循环进行三个操作: 1.输入购买数量,代表为所购买货物的数量赋值,从而计算每项商品金额 2.打印小票,将已有数据打印 3.退出系统(因为该程序为循环操作,无法终 ...
- 2.3点击菜单显示div再点击就隐藏
事件:onclick 属性:display 利用if语句实现 <!DOCTYPE html><html><head><meta charset="u ...
- LitePal用法详解
一.首先我对数据库的操作基于LitePal的,是基于面向对象思想的,所以首先我先讲怎么使用LitePal 1.在build.garde(Module:app)里面的 dependencies{ //添 ...
- Context namespace element 'annotation-config' and its parser class [org.springframework.context.annotation.AnnotationConfigBeanDefinitionParser]
严重: Exception sending context initialized event to listener instance of class org.springframework.we ...
- Vue.js——打包之后资源路径产生问题
https://blog.csdn.net/qq_30632003/article/details/79353035 https://www.cnblogs.com/diantao/p/7776523 ...
- Common.Logging.dll----------配置方式,可选引用,用于日志输出
1.简介common logging是一个通用日志接口,log4net是一个具体实现. common logging可以把输出连接到其他非log类上, 如EntLib的日志.NLog等 2.使用接下来 ...
- druid监控及慢sql记录
本文提要 前文也提到过druid不仅仅是一个连接池技术,因此在将整合druid到项目中后,这一篇文章将去介绍druid的其他特性和功能,作为一个辅助工具帮助提升项目的性能,本文的重点就是两个字:监控. ...