1、相反数
n = int(input());
list1 = list(map(int,input().split()));
count = 0;
for i in list1:
if(-i in list1):
count = count + 1;
result = int(count/2);
print(result);
2、窗口这里需要注意换位;从判断中跳出整个循环;反过来排序
n,m = map(int,input().split());
list2 = [];
list_temp = [];
for i in range(n):
list1 = list(map(int,input().split()));
list2.append(list1);
for i in range(-1,-n-1,-1): #反过来排序
list_temp.append(list2[i][:]);
list3 = []; #定义list3,点击的矩阵
for i in range(m):
list1 = list(map(int,input().split()));
list3.append(list1);
for i in range(m):
count = 0;
index = 0;
result= 0;
for j in range(n):
if(list3[i][0]>=list_temp[j][0] and list3[i][0]<=list_temp[j][2] and list3[i][1]>=list_temp[j][1] and list3[i][1]<=list_temp[j][3]):
count = count+1;
if(count==1): #只要有一个满足,立刻跳出
index = list2.index(list_temp[j][:]);
print(index+1);
list_temp[0][:],list_temp[j][:] = list_temp[j][:],list_temp[0][:]; #换位
result=1;
break;
if(result==1): #经典的从判断跳出整个循环
break;
if(count==0):
print('IGNORED');