第一行为一个整数n(n ≤ 1000),表示超超一共拥有n个陷阱。 第二行有n个整数xi,表示第i个陷阱的横坐标 第三行有n个整数yi,表示第i个陷阱的纵坐标 保证坐标都在草地范围内。
输出一个整数,表示小易最少可能多少秒就落入超超的陷阱
3 4 6 8 1 2 1
3
def distnce(list1,list2): return abs(list1[0] - list2[0]) + abs(list1[1] - list2[1]) n = int(input()) X = list(map(int,input().split())) Y = list(map(int,input().split())) list1 = [1, 1] for i in range(n): list2 = [X[i], Y[i]] if i == 0: min_distance = distnce(list1,list2) else: min_distance = min(min_distance,distnce(list1,list2)) print(min_distance)
n = int(input()) lyst_x = list(map(int, input().split( ))) lyst_y = list(map(int, input().split( ))) a = [] for i in range(n): a.append(lyst_x[i]+lyst_y[i]) print(min(a)-2)
n=int(input()) x=list(map(int,input().split())) y=list(map(int,input().split())) z=[] for i in range(n): z.append(x[i]-1+y[i]-1) print(min(z))
import sys n=sys.stdin.readline().strip().split() x=sys.stdin.readline().strip().split() y=sys.stdin.readline().strip().split() sub = [0 for i in range(int(n[0]))] for i in range(int(n[0])): sub[i]=int(x[i])+int(y[i])-2 min=2000 for i in range(int(n[0])): if sub[i] <min: min=sub[i] print(min)
import sys n = int(sys.stdin.readline().strip()) xlab = sys.stdin.readline().strip().split(' ') xlab = list(map(int, xlab)) ylab = sys.stdin.readline().strip().split(' ') ylab = list(map(int, ylab)) path = list(map(lambda x,y: x+y, xlab,ylab)) print(sorted(path)[0]-2)
n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
A = []
for i in range(n):
A.append(x[i]-1 + y[i]-1)
print(min(A))
#!/usr/bin/env python # -*- coding: UTF-8 -*- import sys n = sys.stdin.readline() xStr = sys.stdin.readline() x = xStr.split() yStr = sys.stdin.readline() y = yStr.split() # 默认最长步数 minStep = (1000-1) + (1000-1) for i in range(int(n)): minStep = (int(x[i])-1) + (int(y[i])-1) if (int(x[i])-1) + (int(y[i])-1) < minStep else minStep print minStep