码迷,mamicode.com
首页 > 其他好文 > 详细

【USACO】transformations

时间:2014-09-11 16:50:52      阅读:267      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   os   ar   for   div   sp   

{
ID: anniel11
PROG: transform
LANG: PASCAL
}
Program transform;
Var
    temp:boolean;
    c:char;
    i,j,n,sum,head,tail:longint;
    map1,map2:array[1..10,1..10] of boolean;
    f:array[0..100000,1..2] of integer;
    flag,flag2:boolean;
Begin
    fillchar(map1,sizeof(map1),false);
    fillchar(map2,sizeof(map2),false);
    Assign(input, transform.in); reset(input);
    Assign(output, transform.out); Rewrite(output);
    Readln(n);
    flag2:=false;
    for i:=1 to n do
    begin
        for j:=1 to n do
        begin
          read(c);
          if c=@ then map1[i,j]:=true;
        end;
        readln;
    end;
    for i:=1 to n do
    begin
        for j:=1 to n do
        begin
          read(c);
          if c=@ then map2[i,j]:=true;
        end;
        readln;
    end;

    //#1 i=j j=n-i+1
    flag:=true;
    for i:=1 to n do
    for j:=1 to n do
    if map2[i,j]<>map1[j,n-i+1] then
    begin
        flag:=false;
        break;
    end;
    if flag then writeln(1);
    if flag then flag2:=true;
    //#2 i`=n-i+1 j=n-j+1
    flag:=true;
    for i:=1 to n do
    for j:=1 to n do
    if map2[i,j]<>map1[n-i+1,n-j+1] then
    begin
        flag:=false;
        break;
    end;
    if flag then writeln(2);
    if flag then flag2:=true;
    //#3 i=n-j+1  j=i
    flag:=true;
    for i:=1 to n do
    for j:=1 to n do
    if map2[i,j]<>map1[n-j+1,i] then
    begin
        flag:=false;
        break;
    end;
    if flag then writeln(3);
    if flag then flag2:=true;
    //#4 i=i j=n-j+1
    flag:=true;
    for i:=1 to n do
    for j:=1 to n do
    if map2[i,j]<>map1[i,n-j+1] then
    begin
        flag:=false;
        break;
    end;
    if flag then writeln(4);
    if flag then flag2:=true;
    //#5 #3 reflect right half
    flag:=true;
    for i:=1 to n do
    for j:=1 to n do
    begin
        if i<=n div 2 then
        if map2[i,j]<>map1[n-j+1,i] then
        begin
                flag:=false;
                break;
        end;

        if i>n div 2 then
        if map2[i,j]<>map1[j,n-i+1] then
        begin
                flag:=false;
                break;
        end;
    end;
    if flag then writeln(5);
    if flag then flag2:=true;
    //#6 i=i j=j
    flag:=true;
    for i:=1 to n do
    for j:=1 to n do
    if map2[i,j]<>map1[i,j] then
    begin
        flag:=false;
        break;
    end;
    if flag then writeln(6);
    if flag then flag2:=true;
    //#7
    if flag2=false then writeln(7);
    close(input);
    close(output);
End.

{
1 2 3 4
4 5 6 8
7 8 9 9
1 1 1 1
1,1 -> 1,3
1,2    2,3
1,3    3,3
2,1    1,2
2,2    2,2
2,3    3,2  }

 

【USACO】transformations

标签:style   blog   color   io   os   ar   for   div   sp   

原文地址:http://www.cnblogs.com/OmegaIota/p/3966580.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!