ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1712. Cipher Grille

test #1
Posted by Yagudin Ruslan 8 Dec 2011 00:35
program Project3;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  re=array[1..4,1..4] of char;
  var
  c,r:re ;

  i,j:integer;
  s:string;

   procedure vyvod(m:re) ;
  begin
   for I := 1 to 4 do
for j := 1 to 4 do
if m[i,j]='X' then write(r[i,j]);
  end;

  procedure perevorot(var w:re) ;
  var
  w2:re;
  begin
  vyvod(w);
  for I := 1 to 4 do
  for j := 1 to 4 do
  w2[i,j]:='.';
    for I := 1 to 4 do
      if w[1,i]='X' then   w2[i,4]:='X';
     for I := 1 to 4 do
      if w[4,i]='X' then   w2[i,1]:='X';
      for I := 2 to 3 do
        if w[i,1]='X' then  w2[1,5-i]:='X';
         for I := 2 to 3 do
        if w[i,4]='X' then  w2[4,i]:='X';
        //rgrgr    X
        if w[2,2]='X' then  w2[2,3]:='X';
        if w[2,3]='X' then  w2[3,3]:='X';
        if w[3,3]='X' then  w2[3,2]:='X';
        if w[3,2]='X' then  w2[2,2]:='X';
        for I := 1 to 4 do
       for j := 1 to 4 do
       w[i,j]:=w2[i,j];



  end;


begin
for I := 1 to 4 do      begin
for j := 1 to 3 do           begin
read(c[i,j]);
end;
readln(c[i,j]);
end;
 for I := 1 to 4 do    begin
for j := 1 to 3 do          begin
read(r[i,j]);
end;
  readln(r[i,j]);
 end;
perevorot(c);
perevorot(c);
perevorot(c);
perevorot(c);
readln;readln;

end.