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
32 1 2 

Input
3

Output
42 1 3 2 

轰炸坦克。

 1 #include<cstdio>
 2 #include<cstdlib>
 3 #include<cstring>
 4 #include<cmath>
 5 #include<algorithm>
 6 #include<queue>
 7 #include<stack>
 8 #include<deque>
 9 #include<map>
10 #include<iostream>
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,m
18 #define rson i << 1 | 1,m + 1,r
19
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<n;i+=2)
36 //                printf("%lld ",i);
37 //        }
38             ans=n+(n/2);
39             printf("%lld\n",ans);
40             for(i=2;i<=n;i+=2)
41                 printf("%lld ",i);
42             for(i=1;i<=n;i+=2)
43                 printf("%lld ",i);
44             for(i=2;i<=n;i+=2)
45                 printf("%lld ",i);
46     }
47     else
48     {
49         if(n==2)
50             printf("3\n2 1 2 ");
51         if(n==3)
52             printf("4\n2 1 3 2 ");
53     }
54     putchar('\n');
55
56     return 0;
57 }

View Code

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

CodeForces 877C相关推荐

  1. CodeForces 375D Tree and Queries

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

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

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

  3. 【codeforces 812C】Sagheer and Nubian Market

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

  4. CodeForces 获得数据

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

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

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

  6. CodeForces 595A

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

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

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

  8. Codeforces Round #506 (Div. 3)

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

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

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

最新文章

  1. CentOS 7.5 如何升级Git实录
  2. Keycloak宣布不再适配Spring Boot和Spring Security
  3. kafka单节点部署无法访问问题解决
  4. 解决烧录问题:Jlink的三线制SWD方式连接STM32芯片无法识别的解决方案
  5. 对状态代码使用JAX-RS异常
  6. Objective-C中的一些特殊的数据类及NSLog的输出格式
  7. 测试低频噪音软件,设计制作并验证0.1Hz10Hz超低频微弱噪音检测放大器要点
  8. 表记录的检索(数据查询)
  9. C语言实现数据结构——单链表
  10. pytorch打包exe出现WARNING: file already exists but should not: C:\Users\workAI\AppData\Local\Temp\_MEI13
  11. vim编辑器模式及使用方法
  12. linux下chm制作工具,在Linux上安装CHM查看工具
  13. 勒索软件Cerber和TeslaCrypt的区别-------典型的勒索软件家族
  14. sql left()函数
  15. python与jay的龙卷风
  16. jQuery表格导出Excel文件以及网页内容导出Word文档
  17. FTTH?FTTB?
  18. ipynb转python(.py)
  19. 路由与交换(一):路由概念及基本配置
  20. 鹏程万里------HIM开发中遇到的问题

热门文章

  1. python自定义函数的关键字_Python3.x中自定义比较函数
  2. python程序运行结果始终为0_Python:始终运行程序
  3. 前端开发那些不常见但十分有效的小玩意
  4. 十行代码实现title滚动显示
  5. 如果是自学WEB前端的话,该如何才能找到一份7K实习生工作呢?
  6. 程序员吐槽:组里新来一个“加班狂”,可把大家害惨了
  7. 具备这些特征,轻松进入互联网大厂成为web前端工程师
  8. python实时连接oracle_python连接oracle数据库
  9. ECC椭圆密码算法c语言实现,深入浅出椭圆加密算法ECC
  10. clock函数返回精度都是上万的_Excel常用函数每日一讲 VLOOKUP函数