每日一九度之 题目1039:Zero-complexity Transposition
时间限制: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的更多相关文章
- 每日一九度之 题目1076:N的阶乘
时间限制:3 秒 内存限制:128 兆 特殊判题:否 提交:7601 解决:2749 题目描述: 输入一个正整数N,输出N的阶乘. 输入: 正整数N(0<=N<=1000) 输出: 输入可 ...
- 每日一九度之 题目1043:Day of Week
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:7336 解决:2563 题目描述: We now use the Gregorian style of dating in Russia. ...
- 每日一九度之 题目1042:Coincidence
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3007 解决:1638 题目描述: Find a longest common subsequence of two strings. 输入 ...
- 每日一九度之 题目1041:Simple Sorting
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:4883 解决:1860 题目描述: You are given an unsorted array of integer numbers. ...
- 每日一九度之 题目1040:Prime Number
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6732 解决:2738 题目描述: Output the k-th prime number. 输入: k≤10000 输出: The k- ...
- 每日一九度之 题目1038:Sum of Factorials
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:2109 解决:901 题目描述: John von Neumann, b. Dec. 28, 1903, d. Feb. 8, 1957, ...
- 每日一九度之 题目1033:继续xxx定律
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:5502 解决:1351 题目描述: 当n为3时,我们在验证xxx定律的过程中会得到一个序列,3,5,8,4,2,1,将3称为关键数, ...
- 每日一九度之 题目1031:xxx定律
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6870 解决:4302 题目描述: 对于一个数n,如果是偶数,就把n砍掉一半:如果是奇数,把n变成 3*n+ 1后砍掉一半,直到该数 ...
- 每日一九度之 题目1030:毕业bg
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:2046 解决:894 题目描述: 每年毕业的季节都会有大量毕业生发起狂欢,好朋友们相约吃散伙饭,网络上称为“bg”.参加不同团体的b ...
随机推荐
- iOS - (TableView中利用系统的 cell 设置 cell.textlabel 位置和大小)
今天工作稍微的遇到了一点小小的难题,需求效果中 TableView cell 中的 Label 字体大小比原先系统中的要大些且 Label 位置不是在前面,而是在中间往后,对于这个问题我第一时间也是想 ...
- Tigase Server Clustering
首先,在服务器上启用集群 修改init.properties --cluster-mode=true 自定义端口 允许自定义,但是所有的实例都要使用相同的端口,以便通讯 --cl-comp-ports ...
- 关于django post表单
CSRF verification failed. Request aborted. 默认会出现该状况,解决办法: 1. 使用requestcontext from django.template i ...
- RMAN-06059: expected archived log not found, loss of archived log compromises recoverability
归档日志被物理删除后执行rman操作报错: RMAN> backup database plus archivelog; Starting backup at -JUL- :: current ...
- 转:python类型转换、数值操作
类型转换 1 函数 描述 2 int(x [,base ]) 将x转换为一个整数 3 ...
- sdutoj 2603 Rescue The Princess
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2603 Rescue The Princess ...
- Ruby On Rails经典书籍下载地址
Web开发敏捷之道-应用Rails进行敏捷Web开发 http://vdisk.weibo.com/s/t47M5Q3WInwc RUBY ON RAILS入门经典 http://downlo ...
- C#: 自定义控件
(一)复合控件 http://wenku.baidu.com/link?url=y4BdtX3mOer4Hdin019jJpXJLi-2_ehmEo7i08cxEp1OR_3gb5CqaHrnNEB2 ...
- cluster集群
http://zwfang09.blog.sohu.com/entry/ Cluster 集群 ,群集 --- 负载均衡 LB ,load-balance --- 高可用集群 HA ,High Ava ...
- BJFU 1009
描述 现在社会上的抽奖活动简直是太多了.前段时间中国联通就举办了一个很无聊的抽奖活动,规则是每人可以向中国联通的短信系统发送一个实数,系统每天会从这些数字中选择一个无重复(就是有且只有一个)且最小的数 ...