这题这遍做之前的N久前在mrzx里做到过…
注意:
不能一开始就贪心地判断是不是输出6(即无任何变化),必须按照1-7的顺序来…挺坑爹的。
check过程用于判断当前操作过后的a是否与b相同。
horizontal过程水平翻转。
rotate过程顺时针90°旋转。
print过程用于输出&结尾。
细节决定成败啊…
Transform
program transformations; var a,b,a0:array[1..10,1..10] of integer; n,i,j:integer; c:char; function check:boolean; var flag:boolean; i,j:integer; begin flag:=true; for i:=1 to n do for j:=1 to n do if a[i,j]<>b[i,j] then exit(false); exit(true); end; procedure horizontal; var i,j:integer; begin for i:=1 to n do for j:=1 to n do a[i,n-j+1]:=a0[i,j]; end; procedure rotate; var i,j:integer; c:array[1..10,1..10] of integer; begin c:=a; for i:=1 to n do for j:=1 to n do a[j,n-i+1]:=c[i,j]; end; procedure print(i:integer); begin writeln(i); close(input);close(output); halt; end; begin assign(input,'transform.in');reset(input); assign(output,'transform.out');rewrite(output); readln(n); for i:=1 to n do begin for j:=1 to n do begin read(c); if c='@' then a0[i,j]:=0 else a0[i,j]:=1; end; readln; end; for i:=1 to n do begin for j:=1 to n do begin read(c); if c='@' then b[i,j]:=0 else b[i,j]:=1; end; readln; end; a:=a0; for i:=1 to 3 do begin rotate; if check then print(i); end; horizontal; if check then print(4); for i:=1 to 3 do begin rotate; if check then print(5); end; a:=a0; if check then print(6); print(7); end.