I have written the following code
T = int(raw_input())
for k in range(T):
print ("Testcase", k)
N = map (int, (raw_input().split()))
max_row = N[0]
max_col = N[1]
rect_length = N[2]
rect_width = N[3]
cell_row = N[4]
cell_col = N[5]
#print number of p*q rectangles
#print ((max_row +1 - rect_length)*(max_col + 1 - rect_width))
for i in range(1, cell_row+1):
print ("i is", i)
if ((cell_row - (rect_length - i)) > 0 and (cell_row + (rect_length-i) <= max_row)):
p = rect_length - i + 1
print ("p is", p)
break
else:
continue
for j in range(1, cell_col+1):
print ("j is", j)
if all ([(cell_col - (rect_width - j)) > 0 , (cell_col + (rect_width-j)) <= max_col]):
q = rect_width - j + 1
break
else:
continue
print ("q is", q)
print p*q
For the below input this code is not working:
1
3 3 1 3 1 1
In the second for loop; the first if condition is false - I see that the for loop is not getting incremented. What have i done wrong?
Aucun commentaire:
Enregistrer un commentaire