import sys def initialize(m,n): if 0<n<10 and 0<m<10: return 0 else: return -1 def insert_line(m,up): if m<9 and 0<=up<m: return 0 else: return -1 #舍弃 def insert_row(n,left): if n<9 and 0<=left<n: return 0 #舍弃 else: return -1 def cell(ex1,ex2,ex3,ex4): l1=[ex2,ex4] l2=[ex1,ex3] c1,c2=0,0 for i in l2: if i>=m or i<0: c1+=1 for i in l1: if i>=n or i<0: c2+=1 if c1+c2!=0: return -1 else: return 0 def cell1(fin1,fin2): c1,c2=0,0 if fin1>=m or fin1<0: c1+=1 if fin2>=n or fin2<0: c2+=1 if c1+c2!=0: return -1 else: return 0 list1=[] for line in sys.stdin: list1.append(line.strip()) li1=[[] for i in range(len(list1)//5)] for j in range(len(list1)//5): for i in range(5): li1[j].append(list1[0]) del list1[0] for i in li1: m,n=map(int,i[0].split()) ex1,ex2,ex3,ex4=map(int,i[1].split()) up=int(i[2].strip()) left=int(i[3].strip()) fin1,fin2=map(int,i[4].split()) print(initialize(m,n)) print(cell(ex1,ex2,ex3,ex4)) print(insert_line(m,up)) print(insert_row(n,left)) print(cell1(fin1,fin2))
标签:fin1,fin2,sys,二维,数组,HJ83 From: https://www.cnblogs.com/tanyuanqing/p/17215577.html