Thursday, December 11, 2014

ACM 1712. Cipher Grille / Шифровальная решётка

Obviously we need to output all the characters where 'X' lies in the corresponding cell, and rotate the field. We need to those steps 4 times, but the hardest part here is rotation.
Have a look at the following 4x4 table.
1234
5678
90ab
cdef
If we rotate it we get
c951
d062
ea73
fb84

As you can see, every Ith row became N-i+1 the column ( if numerate from 1). or A[i][j]=A*[j][N-i+1];



       FULL SOURCE CODE

No comments:

Post a Comment