因为华为认为倒数0节点上是没有值的,所以注意处理k是0的情况

无脑list啊,纯考试够用

while True:
    try:
        count, num_list, k = int(input()), [int(x) for x in input().split()], int(input())
        print(num_list[-k] if k else 0)
    except EOFError:
        break

链表做法,直接逆向遍历

class Node(object):
    def __init__(self, val=0):
        self.val = val
        self.next = None
        
        
while True:
    try:
        head = Node()
        count, num_list, k = int(input()), list(map(int, input().split())), int(input())
        while k:
            head.next = Node(num_list.pop())
            head = head.next
            k -= 1
        print(head.val)
    except EOFError:
        break