P8242 [COCI2013-2014#3] OKVIR 题解
先看了一下题意,还在想暴力会不会超时。直到我看了数据范围。
这一道题,有人刚开始会想读入之后暴力出来背景,再把文字覆盖上去(没错就是我)。但是这道题如果时间少一点就可能超时(可能性不大)。所以考虑打表过。
#include<bits/stdc++.h>
using namespace std;
char c[20][20]={{'#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.'},
{'.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#'},
{'#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.'},
{'.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#'},
{'#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.'},
{'.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#'},
{'#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.'},
{'.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#'},
{'#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.'},
{'.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#'},
{'#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.'},
{'.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#'},
{'#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.'},
{'.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#'},
{'#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.'},
{'.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#'},
{'#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.'},
{'.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#'},
{'#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.'},
{'.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#','.','#'}};
int main(){
ios::sync_with_stdio(false);
int m,n;cin>>m>>n;
int u,l,r,d;cin>>u>>l>>r>>d;
for(int i=u;i<u+m;i++){
for(int j=l;j<l+n;j++){
char chr;
cin>>chr;
c[i][j]=chr;
}
}
for(int i=0;i<u+m+d;i++){
for(int j=0;i<l+n+r;j++){
cout<<c[i][j];
}
cout<<endl;
}
return 0;
}
这打表多是一件美事啊
总的来说这道题没什么坑点,就是我在测试的时候字符不小心溢出了,然后蜂鸣器一直哔个不停。。