52 lines
1.4 KiB
Python
52 lines
1.4 KiB
Python
import time
|
|
|
|
tl = (220, 520)
|
|
tr = (320, 520)
|
|
br = (320, 620)
|
|
bl = (215, 620)
|
|
|
|
number_of_operation = 0
|
|
if (tl[0] - bl[0]) in range (-10,10):
|
|
x = [(tr[0],tl[0]), (tl[0],tr[0])][tl[0]<tr[0]]
|
|
y = [(bl[1],tl[1]), (tl[1],bl[1])][tl[1]<bl[1]]
|
|
elif (tl[0] - tr[0]) in range (-10,10):
|
|
if bl[0] < tl[0]: x = (bl[0],tl[0])
|
|
else: x = (tl[0],bl[0])
|
|
if bl[1] < br[1]: y = (bl[1],br[1])
|
|
else: y = (br[1],bl[1])
|
|
for i in range(x[0], x[1]):
|
|
for j in range(y[0], y[1]):
|
|
number_of_operation += 1
|
|
number_of_operation = [0, number_of_operation/number_of_operation][number_of_operation > 0]
|
|
print(number_of_operation)
|
|
|
|
tl = (320, 520)
|
|
tr = (325, 620)
|
|
br = (220, 620)
|
|
bl = (229, 520)
|
|
number_of_operation = 0
|
|
x = (0,0)
|
|
y = (0,0)
|
|
if (tl[0] - bl[0]) in range (-10,10):
|
|
if tl[0] < tr[0]: x = (tl[0],tr[0])
|
|
else: x = (tr[0],tl[0])
|
|
if tl[1] < bl[1]: y = (tl[1],bl[1])
|
|
else: y = (bl[1],tl[1])
|
|
elif (tl[0] - tr[0]) in range (-10,10):
|
|
if bl[0] < tl[0]: x = (bl[0],tl[0])
|
|
else: x = (tl[0],bl[0])
|
|
if bl[1] < br[1]: y = (bl[1],br[1])
|
|
else: y = (br[1],bl[1])
|
|
for i in range(x[0], x[1]):
|
|
for j in range(y[0], y[1]):
|
|
number_of_operation += 1
|
|
print(number_of_operation)
|
|
|
|
|
|
l = (0,0,0,0,20,42,320)
|
|
for i in l:
|
|
print(max(l))
|
|
|
|
start = time.time()
|
|
while(time.time() - start) < 3:
|
|
print(time.time() - start) |