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

WA test 1
Posted by Jumabek_Alihonov 23 Sep 2011 18:08
my solution

#include<string>
#include<iostream>
using namespace std;
int main()
{char a[4][4],c[4][4];
int  b[4][4],i,j,t;


for(i=1;i<=4;i++)
for(j=1;j<=4;j++)
cin>>c[i][j];
for(i=1;i<=4;i++)
for(j=1;j<=4;j++)

cin>>a[i][j];
cout<<endl;
//1 qator
for(i=1;i<=4;i++)
for(j=1;j<=4;j++)
if(c[i][j]=='X')
cout<<a[i][j];
//2-qator
for(i=1;i<=4;i++)
for(j=1;j<=4;j++)
if(c[i][j]=='X')
  c[j][5-i]='1';


  for(i=1;i<=4;i++)
for(j=1;j<=4;j++)
if(c[i][j]=='1')
cout<<a[i][j];

//3-qator

for(i=1;i<=4;i++)
for(j=1;j<=4;j++)
if(c[i][j]=='1')
c[j][5-i]='2';

for(i=1;i<=4;i++)
for(j=1;j<=4;j++)
if(c[i][j]=='2')
cout<<a[i][j];

for(i=1;i<=4;i++)
for(j=1;j<=4;j++)
if(c[i][j]=='2')
c[j][5-i]='3';
for(i=1;i<=4;i++)
for(j=1;j<=4;j++)
if(c[i][j]=='3')
cout<<a[i][j];
}