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.

Examples

Input
2

Output
32 1 2 

Input
3

Output
42 1 3 2

在一个1*N的格子里很多坦克,你从高空不知道哪些格子里有坦克,但仍然需要扔炸弹把坦克全都炸毁,坦克第一次被炸到后,一定会向前或者向后移一个格子(第一个格子里的坦克只会向后移一个格子,最后一个格子里的坦克只会向前移一个格子),当坦克被第二次炸到的时候才会被炸毁,问你怎样炸,才能使耗费的炸弹最少。

不要一看到这种题就感到无从下手,它肯定是有规律的。

在偶数区间里的坦克移动一次后就都到了奇数区间里,奇数区间里的坦克移动一次后就又到了偶数区间里,于是一个大胆的想法就产生了,先偶数区间炸一遍,再奇数区间炸一遍,最后再偶数区间炸一遍。经验正后,可行。

 1 #include<cstdio>
 2 #include<cstdlib>
 3 #include<cstring>
 4 #include<string>
 5 #include<cmath>
 6 #include<algorithm>
 7 #include<queue>
 8 #include<stack>
 9 #include<deque>
10 #include<map>
11 #include<iostream>
12 using namespace std;
13 typedef long long  LL;
14 const double pi=acos(-1.0);
15 const double e=exp(1);
16 const int N = 10;
17
18 int main()
19 {
20     LL i,p,j,n;
21     LL ans=0,x,y;
22     scanf("%lld",&n);
23     while(1)
24     {
25         ans=n;
26         for(i=2; i<=n; i+=2)
27         {
28             //if(i!=n)
29                 ans++;
30         }
31         printf("%lld\n",ans);
32         if(n>=2)
33             printf("2");
34         for(i=4; i<=n; i+=2)
35             printf(" %lld",i);
36         for(i=1; i<=n; i+=2)
37             printf(" %lld",i);
38         for(i=2; i<=n; i+=2)
39         {
40
41             printf(" %lld",i);
42         }
43         putchar('\n');
44         break;
45     }
46     return 0;
47 }

View Code

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

CodeForces - 877C相关推荐

  1. CodeForces 877C

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

  2. CodeForces 375D Tree and Queries

    传送门:https://codeforces.com/problemset/problem/375/D 题意: 给你一颗有根树,树上每个节点都有其对应的颜色,有m次询问,每次问你以点v为父节点的子树内 ...

  3. 「日常训练」Bad Luck Island(Codeforces Round 301 Div.2 D)

    题意与分析(CodeForces 540D) 是一道概率dp题. 不过我没把它当dp做... 我就是凭着概率的直觉写的,还好这题不算难. 这题的重点在于考虑概率:他们喜相逢的概率是多少?考虑超几何分布 ...

  4. 【codeforces 812C】Sagheer and Nubian Market

    [题目链接]:http://codeforces.com/contest/812/problem/C [题意] 给你n个物品; 你可以选购k个物品;则 每个物品有一个基础价值; 然后还有一个附加价值; ...

  5. CodeForces 获得数据

    针对程序的输出可以看见 CodeForces :当输入.输出超过一定字符,会隐藏内容 所以:分若干个程序进行输入数据的获取 1. 1 for (i=1;i<=q;i++) 2 { 3 scanf ...

  6. codeforces水题100道 第二十七题 Codeforces Round #172 (Div. 2) A. Word Capitalization (strings)...

    题目链接:http://www.codeforces.com/problemset/problem/281/A 题意:将一个英文字母的首字母变成大写,然后输出. C++代码: #include < ...

  7. CodeForces 595A

    题目链接: http://codeforces.com/problemset/problem/595/A 题意: 一栋楼,有n层,每层有m户,每户有2个窗户,问这栋楼还有多少户没有睡觉(只要一个窗户灯 ...

  8. codeforces A. Jeff and Digits 解题报告

    题目链接:http://codeforces.com/problemset/problem/352/A 题目意思:给定一个只有0或5组成的序列,你要重新编排这个序列(当然你可以不取尽这些数字),使得这 ...

  9. Codeforces Round #506 (Div. 3)

    Codeforces Round #506 (Div. 3) 实习期间事不多,对div3 面向题解和数据编程了一波 A. Many Equal Substrings 题目链接 A题就是找后缀和前缀重合 ...

  10. Codeforces Round #417:E. FountainsSagheer and Apple Tree(树上博弈)

    Codeforces Round #417:E. FountainsSagheer and Apple Tree(树上博弈) 标签: codeforces 2017-06-02 11:41 29人阅读 ...

最新文章

  1. NSArray排序问题
  2. 杭电oj1072java实现bfs
  3. UITableView UITableDataSource UITableViewDelegate的基本方法和属性
  4. 应用内截屏的代码,在Activity中测试可用
  5. 栈的典型应用 —— 延迟缓冲
  6. mybatis和spring jdbc持久层框架事务支持分析
  7. OpenSSL密码库算法笔记——第0章 大整数的表示及相关函数
  8. Linux执行sql文件
  9. android带杜比音效的播放器,杜比音乐播放器(杜比音效)
  10. pmp项目变更的流程图_【PMP】变更流程图与说明
  11. 文件没保存怎么恢复?3种方法恢复未保存office文档
  12. spring学期总结
  13. 符号速率,码片速率,业务速率,信道编码,扩频因子
  14. 朋也bbs开源学习(一)
  15. wxwidget编译安装_linux下编译安装wxWidgets-2.8.12和audacity-2.0.3教程
  16. KingbaseES V8R6 ksql 关闭自动提交
  17. 股神巴菲特名言及股神巴菲特选股技巧有哪些
  18. truncate函数
  19. 个人也可以通过维瑞申请VeriSign,Thawte 代码签名证书
  20. 热敏电阻-温度换算算法(分段线性拟合法)

热门文章

  1. C# Json文件读取
  2. hibernate 的session一级缓存
  3. String的创建和常量池的关系,intern()相关问题
  4. 网站安全之密码明文传输漏洞
  5. 【渝粤教育】国家开放大学2018年秋季 1070t组织行为学 参考试题
  6. 【sklearn第一讲】scikit-learn 简介
  7. FPGA智能传感系统(二)基于FPGA的交通灯设计
  8. 接口测试工具——postman
  9. [原译]实现IEnumerable接口理解yield关键字
  10. 转-Linux启动过程详解(inittab、rc.sysinit、rcX.d、rc.local)