时间限制:1 秒

内存限制:32 兆

特殊判题:

提交:3372

解决:1392

题目描述:

You are given a sequence of integer numbers. Zero-complexity transposition of the sequence is the reverse of this sequence. Your task is to write a program that prints zero-complexity transposition of the given sequence.

输入:

For each case, the first line of the input file contains one integer n-length of the sequence (0 < n ≤ 10 000). The second line contains n integers numbers-a1, a2, …, an (-1 000 000 000 000 000 ≤ ai ≤ 1 000 000 000 000 000).

输出:

For each case, on the first line of the output file print the sequence in the reverse order.

样例输入:
5
-3 4 6 -8 9
样例输出:
9 -8 6 4 -3

水题,但是因为是英文,出了一点小(不)问(认)题(识)。

本来认为是绝对值排序,但是后来仔细一看,原来就只是把数组反过来输出就好了。

看懂题目很重要。。是的,真的很重要!

这是不改变数组,直接反过来输出的。

//Asimple
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <stack>
#include <cmath>
#include <map>
#include <string>
#include <queue>
#define INF 100000
using namespace std;
const int maxn = ;
typedef long long ll;
int n, m;
ll a[maxn]; int main(){
while( ~scanf("%d", &n) ){
for(int i=; i<n; i++){
scanf("%ld",&a[i]);
}
for(int i=n-; i>=; i--){
printf(i==?"%ld\n":"%ld ",a[i]);
}
}
return ;
}

做了一点小处理,将数组反了过来。

//Asimple
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <stack>
#include <cmath>
#include <map>
#include <string>
#include <queue>
#define INF 100000
using namespace std;
const int maxn = ;
typedef long long ll;
int n, m;
ll a[maxn]; int main(){
while( ~scanf("%d", &n) ){
for(int i=; i<n; i++){
scanf("%ld",&a[i]);
}
for(int i=; i<n/; i++){
ll temp = a[i];
a[i] = a[n--i];
a[n--i] = temp;
}
for(int i=; i<n; i++){
printf(i==n-?"%ld\n":"%ld ",a[i]);
}
}
return ;
}

每日一九度之 题目1039:Zero-complexity Transposition的更多相关文章

  1. 每日一九度之 题目1076:N的阶乘

    时间限制:3 秒 内存限制:128 兆 特殊判题:否 提交:7601 解决:2749 题目描述: 输入一个正整数N,输出N的阶乘. 输入: 正整数N(0<=N<=1000) 输出: 输入可 ...

  2. 每日一九度之 题目1043:Day of Week

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:7336 解决:2563 题目描述: We now use the Gregorian style of dating in Russia. ...

  3. 每日一九度之 题目1042:Coincidence

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3007 解决:1638 题目描述: Find a longest common subsequence of two strings. 输入 ...

  4. 每日一九度之 题目1041:Simple Sorting

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:4883 解决:1860 题目描述: You are given an unsorted array of integer numbers. ...

  5. 每日一九度之 题目1040:Prime Number

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6732 解决:2738 题目描述: Output the k-th prime number. 输入: k≤10000 输出: The k- ...

  6. 每日一九度之 题目1038:Sum of Factorials

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:2109 解决:901 题目描述: John von Neumann, b. Dec. 28, 1903, d. Feb. 8, 1957, ...

  7. 每日一九度之 题目1033:继续xxx定律

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:5502 解决:1351 题目描述:     当n为3时,我们在验证xxx定律的过程中会得到一个序列,3,5,8,4,2,1,将3称为关键数, ...

  8. 每日一九度之 题目1031:xxx定律

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6870 解决:4302 题目描述:     对于一个数n,如果是偶数,就把n砍掉一半:如果是奇数,把n变成 3*n+ 1后砍掉一半,直到该数 ...

  9. 每日一九度之 题目1030:毕业bg

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:2046 解决:894 题目描述:     每年毕业的季节都会有大量毕业生发起狂欢,好朋友们相约吃散伙饭,网络上称为“bg”.参加不同团体的b ...

随机推荐

  1. SWIFT UITableView的基本用法

    import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: ...

  2. (转)在PHP语言中使用JSON

    原文 : http://www.ruanyifeng.com/blog/2011/01/json_in_php.html --------------------------------------- ...

  3. Ajax.ActionLink()方法的使用

    第一句话都会这么去写:程序猿就是苦逼,除了开发还要会写博文!哎,今天就和大家一起讨论下Ajax的辅助方法ActionLink的使用,如果有讲的不好的地方或错的地方,请大家务必扔板砖,要投准哦,砸死我算 ...

  4. maven 建立ssh项目

    一.新建maven项目,配置ssh框架pom的最低支持 1.新建一个maven项目 依赖于org.springframework/spring-beans/4.1.5.RELEASE 的jar包 Gr ...

  5. PostgreSQL Replication之第九章 与pgpool一起工作(7)

    9.7 处理故障转移和高可用 可以使用pgpool来解决的一些明显的问题是高可用性和故障转移.一般来讲,有使用pgpool或者不使用pgpool可以用来处理这些问题的各种方法. 9.7.1 使用Pos ...

  6. SQL 基本的函数

    select * from emp;

  7. UISearchController的使用

    - (void)addSearchController { _searchController = [[UISearchController alloc] initWithSearchResultsC ...

  8. linux下利用nginx部署python网站

    首先目标机器需要安装python nginx uwsgi,其次,需要给Nginx写配置文件,大体内容如下,具体内容可见 http://blog.cn2p.com/web-server/nginx-uw ...

  9. web处理jsp文件的三个阶段

    web处理jsp文件的三个阶段 翻译阶段(servlet) 编译阶段(class) 执行阶段(print页面标签) 推送html到浏览器

  10. (转载)R14也称作子程序连接寄存器

    R14也称作子程序连接寄存器(Subroutine Link Register)或连接寄存器LR.当执行BL子程序调用指令时,R14中得到R15(程序计数器PC)的备份. 其他情况下,R14用作通用寄 ...