The Grille

题目链接:

http://acm.hust.edu.cn/vjudge/problem/26634

Description


http://7xjob4.com1.z0.glb.clouddn.com/a7d33cb3303ea18c9e6f3de676f242a6

Input


The input contains several test cases. Each test case contains description of a grille and a ciphertext.
Your task is to decipher the message and write the plaintext to output.
Each test case starts with a line containing number N (1 ≤ N ≤ 1000), where N is the size of the
grille. Then there are N lines containing the grille description. Each of those lines contains exactly N
characters which are either the “hash” character ‘#’ (solid/opaque material) or the uppercase letter ‘O’
(hole).
Note: In praxis, the grille holes would be arranged in such a way that no position of the ciphertext
is used more than once. In our problem, this is not guaranteed. Some grilles may contain holes that
match the same position/letter of the ciphertext (after rotations). However, the deciphering algorithm
is still the same.
After the grille description, there are another N lines with the enciphered message. Each of them
contains exactly N characters - uppercase letters of alphabet.
The last test case is followed by a line containing one zero.

Output


For each test case, output the deciphered message (plaintext) on one line with no spaces.

Sample Input


```
4
##O#
#O#O
####
###O
ARAO
PCEM
LEEN
TURC
3
O#O
###
O#O
ABC
DEF
GHI
0
```

Sample Output


ACMCENTRALEUROPE
ACGIACGIACGIACGI

Source


2016-HUST-线下组队赛-1


##题意:

加密过程:每次在空白位置写一个字符,写完后正旋90°再写,重复四次.
求解密后的字符串.


##题解:

瞎转一通就好了.


##代码:
``` cpp
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define LL long long
#define eps 1e-8
#define maxn 1010
#define mod 100000007
#define inf 0x3f3f3f3f
#define mid(a,b) ((a+b)>>1)
#define IN freopen("in.txt","r",stdin);
using namespace std;

int n;

char mes[maxn][maxn];

char key[maxn][maxn];

char ans[maxnmaxn4];

int main(int argc, char const *argv[])

{

//IN;

while(scanf("%d", &n) != EOF && n)
{
for(int i=1; i<=n; i++) {
scanf("%s", key[i]+1);
}
for(int i=1; i<=n; i++) {
scanf("%s", mes[i]+1);
} int cnt = 0;
for(int i=1; i<=n; i++) {
for(int j=1; j<=n; j++) if(key[i][j] == 'O') {
ans[cnt++] = mes[i][j];
}
} for(int i=1; i<=n; i++) {
for(int j=1; j<=n; j++) if(key[n-j+1][i] == 'O') {
ans[cnt++] = mes[i][j];
}
} for(int i=1; i<=n; i++) {
for(int j=1; j<=n; j++) if(key[n-i+1][n-j+1] == 'O') {
ans[cnt++] = mes[i][j];
}
} for(int i=1; i<=n; i++) {
for(int j=1; j<=n; j++) if(key[j][n-i+1] == 'O') {
ans[cnt++] = mes[i][j];
}
} ans[cnt] = 0;
printf("%s\n", ans);
} return 0;

}

UVALive 5886 The Grille (模拟)的更多相关文章

  1. UVALive - 6269 Digital Clock 模拟

    UVALive - 6269 Digital Clock 题意:时钟坏了,给你一段连续的时间,问你现在可能的时间是多少. 思路:直接模拟,他妈的居然这场就跪在了这题,卧槽,他妈的就在111行,居然多打 ...

  2. UVALive - 7139(差分+模拟)

    题目链接 参考 题意 N*M的网格,一辆车沿着网格线按给定路线走,每个网格里有一个人,人的视线始终看着车,问这些人净转圈数的平方和. 分析 由于车的起点和终点都为左上角,且每个格子里的人永远面对着车, ...

  3. UVALive 7464 Robots(模拟)

    7464Robots Write a program to collect data from robots. We are given two sets of robotsX=fX1;:::;Xmg ...

  4. 【Bit String Reordering UVALive - 6832 】【模拟】

    题意分析 题目讲的主要是给你一个01串,然后给你要变成的01串格式,问你要转换成这一格式最少需要移动的步数. 题目不难,但当时并没有AC,3个小时的个人赛1道没AC,归根到底是没有逼自己去想,又想的太 ...

  5. 【Miscalculation UVALive - 6833 】【模拟】

    题目分析 题目讲的是给你一个串,里面是加法.乘法混合运算(个人赛中误看成是加减乘除混合运算),有两种算法,一种是乘法优先运算,另一种是依次从左向右运算(不管它是否乘在前还是加在前). 个人赛中试着模拟 ...

  6. UVaLive 6809 Spokes Wheel (模拟)

    题意:给定两个16进制数,问你把它转成二进制后,把第一个向左或者向右旋转最少的次数同,使得第一个变成第二个. 析:也是比较水的,按照要求做就好,注意0的情况,可能会忘记. #pragma commen ...

  7. UVALive 6858 Frame (模拟)

    Frame 题目链接: http://acm.hust.edu.cn/vjudge/contest/130303#problem/D Description http://7xjob4.com1.z0 ...

  8. 【模拟】ECNA 2015 I What's on the Grille? (Codeforces GYM 100825)

    题目链接: http://codeforces.com/gym/100825 题目大意: 栅栏密码.给定N(N<=10),密钥为一个N*N的矩阵,'.'代表空格可以看到,'X'代表被遮挡,还有密 ...

  9. 模拟/字符串处理 UVALive 6833 Miscalculatio

    题目传送门 /* 模拟/字符串处理:主要是对*的处理,先把乘的预处理后再用加法,比如说是:1+2*3+4 = 1+..6+4 = 11 */ #include <cstdio> #incl ...

随机推荐

  1. Z-偏移量

    使用Z-偏移量 在一个三维场景中,我们可以对共面的多边形使用z-偏移量来使它们不再共面.这项技术通常用于在场景中正确的显示阴影.例如,一堵墙上的阴影与这堵墙的深度值是相同的,如果我们先渲染了墙再来渲染 ...

  2. web开发workflow

    web development是一个创建和实施一个新的互联网展示的过程,web网站可以是个非常成熟包罗万象的网站,也可以只是一个blog或者一两个页面.如果未做好充分的准备,web开发将是一个非常复杂 ...

  3. 有用的shell命令

    1. 查找目录中大小前10 du -hsx * | sort -rh | head -10 2.

  4. UVa 1587 Box

    题意:给出6个矩形的长和宽,问是否能够构成一个长方体 先假设一个例子 2 3 3 4 2 3 3 4 4 2 4 2 排序后 2 3 2 3 3 4 3 4 4 2 4 2 如果要构成一个长方体的话, ...

  5. 一个基于PDO的数据库操作类(新) 一个PDO事务实例

    <?php /* * 作者:胡睿 * 日期:2011/03/19 * 电邮:hooray0905@foxmail.com * * 20110319 * 常用数据库操作,如:增删改查,获取单条记录 ...

  6. VPN协议PPTP/L2TP/OpenVPN及SSH的区别与详解

    大家在使用VPN的时候都会看到商家有提供PPTP VPN.L2TP  VPN.OpenVPN.SSH代理等多种协议选择,但是许多朋友却不知道它们之间有什么区别,也不知道该如何选择,今天整理了一些日常收 ...

  7. mysql:mysql_query(): Unable to save result set

    解决方式 方式1: 原因:数据表索引损坏 方案:使用repair table 表名; 方式2: 原因:打开表的数据量太大,内存不够. 方案:配置my.ini 调整内存能解决

  8. JVM——类的加载过程

    附一张图方便理解,一个类的执行过程 类的加载过程,简明的来说 类装饰器就是寻找类的字节码文件并构造出类在JVM内部表示的对象组件.在Java中,类装载器把一个类装入JVM中,要经过以下步骤: 装载:查 ...

  9. 安卓 Input Events(输入事件)

    在安卓中,有不止一种方法从你的应用截取用户交互事件.在你的用户界面中考虑事件,途径就是从用户界面中的一个指定的view对象中捕获事件.该view提供了这样做的方法. 在你用来组成你布局的不同的view ...

  10. for-in遍历json数据

    1.for遍历json数据 ','fun':'前端开发'} for(var attr in json){ alert(json[attr]) //遍历json属性的数据 alert(json['nam ...