3 条题解
-
0
C :
#include <stdio.h> #include <stdlib.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ /*给你m个整数,将其逆序输出 输入 第一行一个整数m(3 <= m <= 100 ):数的个数 第二行m个整数(空格隔开)(这些数在0-9999999之间) 输出 m个整数(空格隔开*/ void main(int argc, char *argv[]) { int a[100]; int m,i; scanf("%d",&m); for(i=0;i<m;i++){ scanf("%d",&a[i]); } for(i=m-1;i>=0;i--){ printf("%d ",a[i]); } return 0; }
C++ :
#include <bits/stdc++.h> using namespace std; int main(){ int a[100]; int n,i; cin>>n; for(i=0;i<n;i++){ cin>>a[i]; }for(i=n-1;i>=0;i--){ cout<<a[i]<<" "; } return 0; }
Python :
m = int(input()) li = list( map(int,input().split())); li.reverse() for x in li: print(x,end=' ')
- 1
信息
- ID
- 45
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- 3
- 标签
- 递交数
- 192
- 已通过
- 103
- 上传者