九度oj 1039
2015-08-15 21:33
281 查看
题目描述:
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.
样例输入:
样例输出:
来源:
2007年上海交通大学计算机研究生机试真题
#include<iostream>
#include<string.h>
#include<stdlib.h>
using namespace std;
int main()
{
int n;
long long a[10001];
while(cin>>n)
{
for(int i=0;i<n;i++)
{
cin>>a[i];
}
for(int i=n-1;i>0;i--)
{
cout<<a[i]<<" ";
}
cout<<a[0]<<endl;
}
}
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
来源:
2007年上海交通大学计算机研究生机试真题
#include<iostream>
#include<string.h>
#include<stdlib.h>
using namespace std;
int main()
{
int n;
long long a[10001];
while(cin>>n)
{
for(int i=0;i<n;i++)
{
cin>>a[i];
}
for(int i=n-1;i>0;i--)
{
cout<<a[i]<<" ";
}
cout<<a[0]<<endl;
}
}
相关文章推荐
- codeforces#FF DIV2C题DZY Loves Sequences(DP)
- GYM 100523 I【二分图的最大点权独立集】
- POJ-1556
- 黑马程序员----静态(static)
- 关于docker镜像
- LeetCode(237)Delete Node in a Linked List
- Linux系统安装软件
- JAVA的可变类与不可变类
- 数据库系列学习(十)-约束
- junit基础学习之-断言注解(3)
- ttttt
- 编写高质量代码改善C#程序的157个建议——建议43:让接口中的泛型参数支持协变
- LeetCode(237)Delete Node in a Linked List
- gitweb @ Apache [@Windows]
- Hibernate注解
- BestCoder Round #51 (div.2) A
- 一个NDK程序例子
- Apache服务器多站点配置
- 查看当前数据库正在运行的Session
- 黑马程序员----类加载器(ClassLoader)