时间限制:1 秒

内存限制:32 兆

特殊判题:否

提交:3093

解决:1255

题目描述:

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年上海交通大学计算机研究生机试真题

思路:

数组倒序。注意用long long类型存储。

代码:

#include <stdio.h>

#define N 10000

int main(void)
{
int n, i;
long long a[N]; while (scanf("%d", &n) != EOF)
{
for(i=0; i<n; i++)
scanf("%lld", &a[i]); for(i=n-1; i>0; i--)
printf("%lld ", a[i]);
printf("%lld\n", a[i]);
} return 0;
}
/**************************************************************
Problem: 1039
User: liangrx06
Language: C
Result: Accepted
Time:0 ms
Memory:916 kb
****************************************************************/

九度OJ 1039:Zero-complexity Transposition(逆置) (基础题)的更多相关文章

  1. 九度oj 题目1055:数组逆置

    题目1055:数组逆置 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:8225 解决:3932 题目描述: 输入一个字符串,长度小于等于200,然后将数组逆置输出. 输入: 测试数据有多组 ...

  2. 九度OJ 1192:回文字符串 (基础题)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3807 解决:1778 题目描述: 给出一个长度不超过1000的字符串,判断它是不是回文(顺读,逆读均相同)的. 输入: 输入包括一行字符串 ...

  3. 九度OJ 1033:继续xxx定律 (基础题)

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

  4. 九度OJ 1058:反序输出 (基础题)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:8454 解决:3042 题目描述: 输入任意4个字符(如:abcd), 并按反序输出(如:dcba) 输入: 题目可能包含多组用例,每组用例 ...

  5. 九度OJ 1053:互换最大最小数 (基础题)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6613 解决:2676 题目描述: 输入一个数n,然后输入n个数值各不相同,调换数组中最大和最小的两个数,然后输出. 输入: 测试数据有多组 ...

  6. 九度OJ 1048:判断三角形类型 (基础题)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6794 解决:3361 题目描述: 给定三角形的三条边,a,b,c.判断该三角形类型. 输入: 测试数据有多组,每组输入三角形的三条边. 输 ...

  7. 九度OJ 1045:百鸡问题 (基础题)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:8410 解决:3644 题目描述: 用小于等于n元去买100只鸡,大鸡5元/只,小鸡3元/只,还有1/3元每只的一种小鸡,分别记为x只,y只 ...

  8. 九度OJ 1015:还是A+B (基础题)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6773 解决:4031 题目描述: 读入两个小于10000的正整数A和B,计算A+B.需要注意的是:如果A和B的末尾K(不超过8)位数字相同 ...

  9. 九度OJ 1128:求平均年龄 (基础题)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:2080 解决:1084 题目描述: 班上有学生若干名,给出每名学生的年龄(整数),求班上所有学生的平均年龄,保留到小数点后两位. 输入: 第 ...

随机推荐

  1. python对象的复制问题

    list 的拷贝问题: 1, >>> a [1, 2] >>> b=a[:] >>> b [1, 2] >>> b[0]=20 ...

  2. PHP利用lua实现Redis Sorted set的zPop操作

    function zPop($key) { $script = <<<EOD local v = redis.call('zrange', KEYS[1], 0, 0); if v[ ...

  3. smartsvn学习(-)

    3. Day-to-day use 3.1 Everyday commands Most of the common commands you will need are in the SmartSV ...

  4. ios notification

    apps can use local or push notifications to let people know when interesting things happen, such as: ...

  5. 140. Word Break II(hard)

    欢迎fork and star:Nowcoder-Repository-github 140. Word Break II 题目: Given a non-empty string s and a d ...

  6. matlab修改文件名和删除某类文件

    matlab修改多级文件夹路径下的文件名: % %%%%%%%%%%%%%%批量修改文件名一级文件夹 \路径下直接为文件 % close all;clear all;clc; % path='G:\1 ...

  7. 单选复选框的js代码取值

    单选框 复选框选中后的js代码处理 <script type="text/javascript"> function check(){ document.getElem ...

  8. 又一次认识java(九) ---- 内部类

    注意注意!! ! 前排提示!!.本篇文章过长,最好收藏下来慢慢看.假设你之前对内部类不是非常熟悉,一次性看完,大概你会懵逼. . . 1. 内部类概述 一个类的定义放在还有一个类的内部,这个类就叫做内 ...

  9. Redhat Crash Utility-Ramdump

    Redhat Crash Utility edit by liaoye@2014/9/16 http://blog.csdn.net/paul_liao Crash utility是redhat提供的 ...

  10. Linux环境变量PS1配置

    1. 说明: 在Shell下,我们能够拥有更加色慘斑斓的提示行信息.这能够通过改变bash的$PS1环境变量还设置,如以下就是提示行的一种: user@host$ root用户的提示是这种: user ...