import copy total = int(input()) for k in range(total): res=0 W,H = map(int,input().split()) background = [] for r in range(H): background.append([char for char in input()]) temp = copy.deepcopy(background) P,Q = map(int,input().split()) character = [] for r in range(Q): character.append([char for char in input()]) i,j,a,b = map(int,input().split()) while i<=H and j<=W: print(background) count=0 for x in range(Q): for y in range(P): if 1<=(x+i)<=H and 1<=(y+j)<=W: if (character[x][y]!=background[x+i-1][y+j-1]): background[x+i-1][y+j-1]=character[x][y] count+=1 elif y+j>W: break for x in range(H): for y in range(W): if (x==i-b-1&nbs***bsp;y==j-a-1) and background[x][y]!=temp[x][y]: background[x][y] = temp[x][y] count+=1 elif y>j-a-1: break print(count) res+=count i+=b j+=a print(res) 哭了,是我太菜T T
全部评论
(0) 回帖