地址:http://codeforces.com/contest/764/problem/B

题目:

B. Timofey and cubes
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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

思路:水题,看代码即可

代码

 #include <bits/stdc++.h>

 using namespace std;

 #define MP make_pair
#define PB push_back
typedef long long LL;
typedef pair<int,int> PII;
const double eps=1e-;
const double pi=acos(-1.0);
const int K=1e6+;
const int mod=1e9+; int n,a[K];
int main(void)
{
cin>>n;
for(int i=;i<=n;i++)cin>>a[i];
for(int i=;i<=n-i+;i++)
if(i&)
swap(a[i],a[n-i+]);
for(int i=;i<=n;i++)
printf("%d ",a[i]); return ;
}

Codeforces Round #395 (Div. 2)B. Timofey and cubes的更多相关文章

  1. Codeforces Round #395 (Div. 2) D. Timofey and rectangles

    地址:http://codeforces.com/contest/764/problem/D 题目: D. Timofey and rectangles time limit per test 2 s ...

  2. Codeforces Round #395 (Div. 2) C. Timofey and a tree

    地址:http://codeforces.com/contest/764/problem/C 题目: C. Timofey and a tree time limit per test 2 secon ...

  3. 【分类讨论】Codeforces Round #395 (Div. 2) D. Timofey and rectangles

    D题: 题目思路:给你n个不想交的矩形并别边长为奇数(很有用)问你可以可以只用四种颜色给n个矩形染色使得相接触的 矩形的颜色不相同,我们首先考虑可不可能,我们分析下最多有几个矩形互相接触,两个时可以都 ...

  4. 【树形DP】Codeforces Round #395 (Div. 2) C. Timofey and a tree

    标题写的树形DP是瞎扯的. 先把1看作根. 预处理出f[i]表示以i为根的子树是什么颜色,如果是杂色的话,就是0. 然后从根节点开始转移,转移到某个子节点时,如果其子节点都是纯色,并且它上面的那一坨结 ...

  5. Codeforces Round #297 (Div. 2)E. Anya and Cubes 折半搜索

    Codeforces Round #297 (Div. 2)E. Anya and Cubes Time Limit: 2 Sec  Memory Limit: 512 MBSubmit: xxx  ...

  6. Codeforces Round #395 (Div. 2)(A.思维,B,水)

    A. Taymyr is calling you time limit per test:1 second memory limit per test:256 megabytes input:stan ...

  7. Codeforces Round #395 (Div. 2)(未完)

    2.2.2017 9:35~11:35 A - Taymyr is calling you 直接模拟 #include <iostream> #include <cstdio> ...

  8. Codeforces Round #395 (Div. 2)

    今天自己模拟了一套题,只写出两道来,第三道时间到了过了几分钟才写出来,啊,太菜了. A. Taymyr is calling you 水题,问你在z范围内  两个序列  n,2*n,3*n...... ...

  9. Codeforces Round #395 (Div. 2) D

    Description One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On t ...

随机推荐

  1. XHTML XML

    XHTML是可扩展的超文本标记语言(Extensible HyperText Markup Language). l  XHTML是w3c组织在2000年的时候为了增强HTML推出的,本来是想替代HT ...

  2. 尽管以C++为基础,但 Java 是一种更纯粹的面向对象程序设计语言

    “尽管以C++为基础,但 Java 是一种更纯粹的面向对象程序设计语言”. 无论C++还是Java 都属于杂合语言.但在 Java 中,设计者觉得这种杂合并不象在 C++里那么重要.杂合语言 允许采用 ...

  3. petrozavodsk summer 2018 游记&&总结

    day0: 出发前训了一场比较水bapc2017保持手感(恢复信心),成功AK了,不过罚时略高.然后三人打车从紫金港到杭州东站,坐高铁到上海虹桥,再坐机场快线到浦东机场(傻乎乎的jsb帮爸爸付了钱,然 ...

  4. EasyUI左右布居

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"><head runat=&quo ...

  5. Microsoft Visual C++ 2005 Redistributable---win下安装软件“嘭”的一声报错!

    今天下了个MindManager,正准备安装结果出现了如题的错误提示!!! 于是百度/google一下,在权威的微软官网下找到了答案,他妈的,看了之后表示很无奈 If the non unicode ...

  6. Android中Bitmap、Drawable、byte[]转换

    public byte[] getBitmapByte(Bitmap bitmap){ ByteArrayOutputStream out = new ByteArrayOutputStream(); ...

  7. Castle 整合.NET Remoting

    今天研究了一下Castle的Remoting Facility.记录如下: 微软以前使用COM/DCOM的技术来处理分布式系统架构,通过Client端的Proxy代理程序来呼叫远程Server机器上的 ...

  8. ng-template

    一,锚点链接 定义锚点: <a href="#login" class="btn btn-primary">Login</a> < ...

  9. 【Lombok】了解

    项目中使用了 Lombok ,对象无需写get set 等方法,一个注释便可以搞定.IDEA中项目报错,下载对应插件(Lombok Plugin)就好了.很神奇,就了解一下: 官网: Project ...

  10. crash处理core文件

    (一时心血来潮总结的,供大家参考,时间仓促,不足之处勿拍砖,欢迎讨论~)Crash工具用于解析Vmcore文件,Vmcore文件为通过kdump等手段收集的操作系统core dump信息,在不采用压缩 ...