地址: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. struts中如何实现国际化,涉及哪些文件?

    struts中如何实现国际化,涉及哪些文件? 解答:“国际化”是指一个应用程序在运行时能够根据客户端请求所来自的国家/地区.语言的不同而显示不同的用户界面.Struts框架通过使用<bean:m ...

  2. CodeSmith自动生成代码使用

    官网地址:http://www.codesmithtools.com/ CodeSmith开发系列资料总结 http://terrylee.cnblogs.com/archive/2005/12/28 ...

  3. 65、TextView 字体设置不同颜色 --- 未完

    mTextView.setText(Html.fromHtml("教练评论" + "<font color='#b0b0b0'>" + " ...

  4. ZOJ 2676 Network Wars[01分数规划]

    ZOJ Problem Set - 2676 Network Wars Time Limit: 5 Seconds      Memory Limit: 32768 KB      Special J ...

  5. iOS UITextView 展示html

    NSString *htmlString = @"<h1>Header</h1><h2>Subheader</h2><p>Some ...

  6. java的poi导入excel时解析日期

    if (r.getCellType()==Cell.CELL_TYPE_NUMERIC){ if(HSSFDateUtil.isCellDateFormatted(r)){ //用于转化为日期格式 D ...

  7. 【文章阅读】详解MySQL数据类型

    详解MySQL数据类型 - 五月的仓颉 - 博客园 http://www.cnblogs.com/xrq730/p/8446246.html 注:对于MySQL的数据类型做了详细的讲解,这是我看过的最 ...

  8. [cocos2dx] cocosdx编译工程那些事

    cocos compile -p android 上面这条命令可以将cocos2dx的工程编译出android apk,需要注意的是如果有新增的cpp文件,都需要在“CocosProject\proj ...

  9. 解决phantomjs输出中文乱码

    解决phantomjs输出中文乱码,可以在js文件里添加如下语句: phantom.outputEncoding="gb2312"; // 解决输出乱码

  10. CSRF Laravel

    Laravel 使得防止应用 遭到跨站请求伪造攻击变得简单. Laravel 自动为每一个被应用管理的有效用户会话生成一个 CSRF “令牌”,该令牌用于验证授权用 户和发起请求者是否是同一个人. 任 ...