题干:

Young Timofey has a birthday today! He got kit of n cubes as a birthday present from his parents. Every cube has a number ai, which is written on it. Timofey put all the cubes in a row and went to unpack other presents.

In this time, Timofey's elder brother, Dima reordered the cubes using the following rule. Suppose the cubes are numbered from 1 to n in their order. Dima performs several steps, on step i he reverses the segment of cubes from i-th to (n - i + 1)-th. He does this while i ≤ n - i + 1.

After performing the operations Dima went away, being very proud of himself. When Timofey returned to his cubes, he understood that their order was changed. Help Timofey as fast as you can and save the holiday — restore the initial order of the cubes using information of their current location.

Input

The first line contains single integer n (1 ≤ n ≤ 2·105) — the number of cubes.

The second line contains n integers a1, a2, ..., an ( - 109 ≤ ai ≤ 109), where ai is the number written on the i-th cube after Dima has changed their order.

Output

Print n integers, separated by spaces — the numbers written on the cubes in their initial order.

It can be shown that the answer is unique.

Examples

Input

7
4 3 7 6 9 1 2

Output

2 3 9 6 7 1 4

Input

8
6 1 4 2 5 6 9 2

Output

2 1 6 2 5 4 9 6

Note

Consider the first sample.

  1. At the begining row was [2, 3, 9, 6, 7, 1, 4].
  2. After first operation row was [4, 1, 7, 6, 9, 3, 2].
  3. After second operation row was [4, 3, 9, 6, 7, 1, 2].
  4. After third operation row was [4, 3, 7, 6, 9, 1, 2].
  5. At fourth operation we reverse just middle element, so nothing has changed. The final row is [4, 3, 7, 6, 9, 1, 2]. So the answer for this case is row [2, 3, 9, 6, 7, 1, 4].

解题报告:

直接模拟,分n的奇偶两种情况。找一下样例的规律就出来了。。。

AC代码:

#include<bits/stdc++.h>using namespace std;
int a[200000 + 5];
int main()
{int n;cin>>n;for(int i = 1; i<=n; i++) cin>>a[i];printf("%d",a[n]);if(n%2==1) {for(int i = 2; i<=n; i++) {if(i%2==0) printf(" %d",a[i]);else printf(" %d",a[n-i+1]);}}else {for(int i = 2; i<=(n/2); i++) {if(i%2==0) printf(" %d",a[i]);else printf(" %d",a[n-i+1]);}for(int i = (n/2) + 1; i<=n; i++) {if(i%2==1) printf(" %d",a[i]);else printf(" %d",a[n-i+1]);}}return 0 ;
}

【CodeForces - 764B 】Timofey and cubes (模拟)相关推荐

  1. CodeForces - 764B Timofey and cubes

    CodeForces - 764B Timofey and cubes 这个题其实压根不用读题,看样例猜反而更简便. Young Timofey has a birthday today! He go ...

  2. CodeForces 1463 C. Busy Robot 模拟

    CodeForces 1463 C. Busy Robot 模拟 题目大意: 有一个一维坐标轴,在最初时刻有个机器人位于坐标 0 0 0 位置,有 n n n 个命令,对于每一个命令在 t i t_i ...

  3. BZOJ 3836 Codeforces 280D k-Maximum Subsequence Sum (模拟费用流、线段树)

    题目链接 (BZOJ) https://www.lydsy.com/JudgeOnline/problem.php?id=3836 (Codeforces) http://codeforces.com ...

  4. 【CodeForces Round #550】A-F | 模拟 | 贪心 | 高精 | BFS | 二分图 | E

    今年怎么没有愚人节比赛了   CF你看看人家洛谷   唉鸭原来那边还没到愚人节呢- 愚人节比赛还是有的,在今晚 qwq [CodeForces 1144   A-F] Tags:模拟 贪心 BFS 高 ...

  5. CodeForces - 1328F Make k Equal(模拟)

    题目链接:点击查看 题目大意:给出一个数列 a ,现在有两种操作: 找到一个最小值,使其值加一 找到一个最大值,使其值减一 注意这里找到一个最值进行的操作,是针对最值不唯一的情况,题目问至少需要进行多 ...

  6. CodeForces - 1321C Remove Adjacent(贪心+模拟)

    题目链接:点击查看 题目大意:给出一个长度不超过100且只包含小写字母的字符串,现在规定,如果某个位置 i 的相邻位置存在着当前位置所代表字母的前一个字母,即 i - 1 和 i + 1 中存在着 a ...

  7. CodeForces - 1208E Let Them Slide(模拟+multiset)

    题目链接:点击查看 题目大意:给出n个数列,每行放一个,现在指定一个宽度w,满足w不小于n个数列中最长的那个数列的长度,现在可以将n个数列都放入到一个n*w的矩形之中,每个数列可以在各自的行内左右移动 ...

  8. CodeForces - 546C Soldier and Cards(模拟)

    题目链接:点击查看 题目大意:两个人在玩游戏,初始时两个人分别有一定数量的牌,牌面的大小一定是互不相同的,游戏规则如下: 每次两个人同时从自己牌堆的最顶端取出一张牌,我们可以记做a和b,比较一下其大小 ...

  9. CodeForces - 224C. Bracket Sequence (栈模拟)简单做法

    A bracket sequence is a string, containing only characters "(", ")", "[&quo ...

最新文章

  1. 一起学Hadoop——Hadoop的前世今生
  2. 汇编实验2.2 查找匹配字符串(附有详细注释和源代码和相关知识)
  3. sizeof()与strlen()
  4. 红米手机停在机器人这里_iQOO Z1和红米K30 至尊纪念版,谁更值得选择?
  5. web开发——Flask框架
  6. linux下eclipse进行ndk调试,超简单,写的超清晰
  7. 如何优雅的定义 App 的界面设计
  8. 在无锡调试的工作,到了泰安出错了
  9. JMeter 录制脚本
  10. Windows本地认证
  11. 网易互娱2017实习生招聘游戏研发工程师在线笔试第二场(神奇的数)
  12. layui数据表格自带的排序功能
  13. LA 5713 秦始皇修路
  14. 支付宝扫码支付模式平台介绍
  15. Ubuntu22.04虚拟机配置及使用代理工具
  16. LWN:在Linux上用Waydroid运行安卓应用!
  17. C#地磅称重无人值守管理软件
  18. 中兴2022海外岗位招聘经验
  19. [转载]redis和 redis的php扩展
  20. python实现希尔排序_希尔排序算法的python实现

热门文章

  1. [周赛第200场][Leetcode][第5477题][第5478题][JAVA][双指针][贪心]
  2. base64 转文件_PHP伪协议与文件包含
  3. android 平板方案,Android平板方案
  4. c++ 结构体初始化_STM32入门系列-使用库函数点亮LED,LED初始化函数
  5. linux远程虚拟桌面,2020-07-23 Linux 远程连接虚拟桌面
  6. python操作sqlite3 导入csv文件_[转载]SQLite 3导入导出成txt或csv操作
  7. warning no newline at the end of file
  8. VxWorks嵌入式操作系统的TrueFFS文件系统驱动开发
  9. 五大算法之三--贪心算法
  10. 一面微创题--字符串逆序输出