C. Slava and tanks
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

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

Examples
input
2
output
3
2 1 2
input
3
output
4
2 1 3 2 题意:
n列格子上有inf辆坦克
每辆坦克两滴血
向第i列扔炸弹,第i列的坦克会移动到i-1和i+1列,减一滴血
问最少扔多少炸弹,炸毁所有坦克 先往偶数格打,所有坦克跑到奇数格
再往奇数格打,所有坦克跑到偶数格
再往偶数格打,所有坦克打死
#include<cstdio>

using namespace std;

int n;

int main()
{
scanf("%d",&n);
printf("%d\n",n+n/);
for(int i=;i<=n;i+=) printf("%d ",i);
for(int i=;i<=n;i+=) printf("%d ",i);
for(int i=;i<=n;i+=) printf("%d ",i);
}

最新文章

  1. HDU 4946 Area of Mushroom(2014 Multi-University Training Contest 8)
  2. HBase读延迟的12种优化套路
  3. 简明 Git 命令速查表
  4. sp_help 快速查看表结构、视图信息
  5. vb和php 基于socket通信
  6. AX调用.dll
  7. Java动态替换InetAddress中DNS的做法简单分析1
  8. ACE的安装方法
  9. java WebService简单使用案例
  10. implode 多维数组转一维数组并字符串输出
  11. 搭建HWI(HiveWebInterface)步骤总结
  12. LINQ对List列表随机排序,取N条数据
  13. Delphi 调用系统中的计算器、记事本、画图软件方法
  14. Maven详解(三)------ Maven工程目录介绍
  15. inotify-tools + php脚本实现Linux服务器文件监控并邮件提醒
  16. 【填坑纪事】一次用System.nanoTime()填坑System.currentTimeMills()的实例记录
  17. DevExpress VCL 的 cxDBTreeList 的使用方法
  18. ASP.NET 登录验证 ihttpmoudle
  19. Linq to Sharepoint--如何获取Linq Query 生成的CALM
  20. 各版本的区别及含义(i386 、x86_64 、ppc )

热门文章

  1. Linux手动添加系统环境共享库路径
  2. Leetcode题库——14.最长公共前缀
  3. linux ls文件颜色和底色设置
  4. 浅析Web数据存储-Cookie、UserData、SessionStorage、WebSqlDatabase
  5. js 添加事件兼容性
  6. java 创建过程
  7. zabbix短信(阿里云短信平台)与邮件报警
  8. php的数组转为对象
  9. Longest Word in Dictionary through Deleting - LeetCode
  10. BZOJ2878 [Noi2012]迷失游乐园 【基环树 + 树形dp + 期望dp】