博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CodeForces 877C
阅读量:5158 次
发布时间:2019-06-13

本文共 2113 字,大约阅读时间需要 7 分钟。

Slava plays his favorite game "Peace Lightning". Now he is flying a bomber on a very specific map.

Formally, map is a checkered field of size 1 × n, the cells of which are numbered from 1 to n, in each cell there can be one or several tanks. Slava doesn't know the number of tanks and their positions, because he flies very high, but he can drop a bomb in any cell. All tanks in this cell will be damaged.

If a tank takes damage for the first time, it instantly moves to one of the neighboring cells (a tank in the cell n can only move to the cell n - 1, a tank in the cell 1 can only move to the cell 2). If a tank takes damage for the second time, it's counted as destroyed and never moves again. The tanks move only when they are damaged for the first time, they do not move by themselves.

Help Slava to destroy all tanks using as few bombs as possible.

Input

The first line contains a single integer n (2 ≤ n ≤ 100 000) — the size of the map.

Output

In the first line print m — the minimum number of bombs Slava needs to destroy all tanks.

In the second line print m integers k1, k2, ..., km. The number ki means that the i-th bomb should be dropped at the cell ki.

If there are multiple answers, you can print any of them.

Sample Input

Input
2
Output
3 2 1 2
Input
3
Output
4 2 1 3 2 轰炸坦克。
1 #include
2 #include
3 #include
4 #include
5 #include
6 #include
7 #include
8 #include
9 #include
10 #include
11 using namespace std;12 typedef long long LL;13 const double pi=acos(-1.0);14 const double e=exp(1);15 const int N = 100010;16 17 #define lson i << 1,l,m18 #define rson i << 1 | 1,m + 1,r19 20 int main()21 {22 LL n,i,p=0,j;23 LL ans=0;24 scanf("%lld",&n);25 if(n>=4)26 {27 // if(n%2==0)28 // {29 // ans=n+(n/2)-1;30 // printf("%lld\n",ans);31 // for(i=2;i<=n;i+=2)32 // printf("%lld ",i);33 // for(i=1;i<=n;i+=2)34 // printf("%lld ",i);35 // for(i=2;i
View Code

 

转载于:https://www.cnblogs.com/daybreaking/p/9417799.html

你可能感兴趣的文章
HBase性能优化方法总结(四):数据计算
查看>>
洛谷 P1002 过河卒
查看>>
The JavaScript this Keyword
查看>>
var $this = $(this)
查看>>
添加了click事件不响应
查看>>
Excel导出失败的提示
查看>>
汇编指令
查看>>
Mysql数据库中InnoDB和MyISAM的差别
查看>>
Java并发编程:深入剖析ThreadLocal
查看>>
IPC进程通信机制
查看>>
bat文件调用php文件
查看>>
很有用的Jquery代码片段(转)
查看>>
bzoj2018年5月赛
查看>>
OperationalError:(1054 - "Unknown column 'game.lable1' in 'field list' ")解决办法
查看>>
震惊!小学生的300道四则运算题目竟然是这样做出来的!
查看>>
百度BAE环境下WordPress安装教程
查看>>
windows索引服务
查看>>
Linux学习之CentOS(十三)--CentOS6.4下Mysql数据库的安装与配置
查看>>
微信支付结果通用通知
查看>>
Android API Guides---Tasks and Back Stack
查看>>