HWOJ输出单向链表中倒数第k个结点
2017-02-19 本文已影响0人
Yuu_CX
import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] num = new int[n];
for(int i=0; i<n; i++){
num[i] = sc.nextInt();
}
int k = sc.nextInt();
System.out.println(num[num.length-k-1]);
}
}