Exercício 2 - Resolvido
Click here to get the file
Size
1 kB
-
File type
text/python-source
File contents
with open("E1.in","r") as fin:
retA = fin.readline()
retA = retA.split()
retB = fin.readline()
retB = retB.split()
ax1=float(retA[0])
ay1=float(retA[1])
ax2=float(retA[2])
ay2=float(retA[3])
bx1=float(retB[0])
by1=float(retB[1])
bx2=float(retB[2])
by2=float(retB[3])
if ax1<bx1:
if ax2>bx1: #candidato ok para eixo x
if ay1<by1:
if ay2>=by1:
colide="1"
else:
colide="0"
else:
if ay1<=by2:
colide="1"
else:
colide="0"
else:
colide="0"
else:
if ax1<=bx2: #candidato ok para eixo x
if ay1<by1:
if ay2>=by1:
colide="1"
else:
colide="0"
else:
if ay1<=by2:
colide="1"
else:
colide="0"
else:
colide="0"
with open("E2.out","w") as fout:
fout.write(colide + "\n")