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
import java.util.Scanner;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] nums = new int[n];
for (int i = 0; i<n; i++) {
nums[i] = sc.nextInt();
}
for (int i = 0,j = nums.length-1;i<j;i++,j--) {
int temp = nums[i];
nums[i] = nums[j];
nums[j] = temp;
}
for (int i = 0; i < nums.length; i++) {
if(i!= nums.length-1){
System.out.print(nums[i]+" ");
}else{
System.out.print(nums[i]);
}
}
}
} import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s;
while ((s = br.readLine()) != null) {
int n = Integer.parseInt(s);
String[] ss = br.readLine().split(" ");
for (int i = n - 1; i >= 0; --i) {
System.out.print(ss[i] + " ");
}
}
}
}