解法一:
装作没看到,当数组解 :)
while True: try: l, s, k = int(input()), input().split(), int(input()) print(s[l - k] if k else 0) except: break
解法二:
自己定义节点再连成链表咯 :)
class Node(object): def __init__(self, val=0): self.val = val self.next = None while True: try: l, s, k, head = int(input()), list(map(int, input().split())), int(input()), Node() while k: head.next = Node(s.pop()) head = head.next k -= 1 print(head.val) except: break
提交结果