时间限制: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. ThinkPHP分页链接支持数组参数的办法

    这几天在用ThinkPHP做系统,搜索页有个数组参数提交 <input class="params_t" name="t[]" type="ch ...

  2. mongodb远程连接以及备份、还原、导出、导入

    一.远程连接mongodb 连接命令:mongo -u username -p pwd 192.168.41.215:27017/database(用户名对应的数据库) 二.mongodump备份数据 ...

  3. 在navgationController中添加UISegmentedControl

    NSArray *segmentedArray = [NSArray arrayWithObjects:@"患者基本信息",@"患者信息",nil]; UISe ...

  4. .pch头文件的添加

    在工程中找Building Settings --> language -->prefix Header -->填写.pch的路径

  5. Leetcode: Convert a Number to Hexadecimal

    Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two's compl ...

  6. 树形DP+二分(Information Disturbing HDU3586)

    题意:给出一颗数,1结点代表司令部,叶子节点代表前线,边全值代表花费,然后需要在某些边放置一些炸弹,炸弹的能量不能小于该边的费用,且炸掉的总费用不能超过m问炸弹能力最小多少, 分析dfs+二分,二分枚 ...

  7. 活动组件(五):一个activity的例子

    建立两个Activity,一个是NormalActivity,另一个是DialogActivity.首先建立这两个Activity的布局文件,如下图: 然后编写这连个Activity,如下: 接着对这 ...

  8. exec 临时表,报错

    因为零时表只存在于一个exec 会话中,所以可以用 多个 select 返回到 dataset 中处理多个table,按照select 的顺序,读取 tables[0],table[1] , 多用于统 ...

  9. Tomcat8.5

    说明:Tomcat服务器上一个符合J2EE标准的Web服务器,在tomcat中无法运行EJB程序,如果要运行可以选择能够运行EJB程序的容器WebLogic,WebSphere,Jboss等Tomca ...

  10. spark小技巧-mapPartitions

    与map方法类似,map是对rdd中的每一个元素进行操作,而mapPartitions(foreachPartition)则是对rdd中的每个分区的迭代器进行操作.如果在map过程中需要频繁创建额外的 ...