题意:解码,输入板子一块,字母table一块 有hOle的就读取,然后顺时旋转90度
简单题,就是旋转本来想麻烦了,但是我有两个好队友......
水题一枚 注意输入输出+旋转即可
不过如果把板子全部扫描就TLE了,于是存O点
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
char s[1005][1005];
struct hole
{
int x,y;
}h[1000005];
void roll_90(hole &a,int n)
{
int x=a.y,y=n-a.x-1;
a.x=x;
a.y=y;
}
bool cmp(hole a,hole b)
{
if(a.x<b.x)
return 1;
else if(a.x==b.x)
if(a.y<b.y)
return 1;
return 0;
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("h.in","r",stdin);
#endif // ONLINE_JUDGE
int n;
while(~scanf("%d",&n)&&n)
{
getchar();
char tmp;
int cnt=0;
for(int _=0;_<n;_++)
{
for(int __=0;__<n;__++)
{
scanf("%c",&tmp);
if(tmp=='O') h[cnt].x=_,h[cnt++].y=__;
//printf("%c",tmp);
}
//puts("");
getchar();
}
for(int _=0;_<n;_++)
{
for(int __=0;__<n;__++)
scanf("%c",&s[_][__]);
//puts(s[_]);
getchar();
}
for(int _=0;_<4;_++)
{
sort(h,h+cnt,cmp);
for(int __=0;__<cnt;__++)
{
//printf("\n%d,%d\n",h[__].x,h[__].y);
printf("%c",s[h[__].x][h[__].y]);
roll_90(h[__],n);
}
}
puts("");
}
return 0;
}