| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
为何OLE?#include <iostream>
using namespace std;
char Map[2][100][100];
int main()
{
int n,i,j,k,l,Days,H,W,temp;
cin>>n;
for (i=0;i<n;i++)
{
cin>>H>>W>>Days;
for (j=0;j<H;j++)cin>>Map[0][j];
for (j=0;j<H;j++)
for (k=0;k<W;k++)
Map[1][j][k]=Map[0][j][k];
for (j=0;j<Days;j++)
{
for (k=0;k<H;k++)
for (l=0;l<W;l++)
Map[0][k][l]=Map[1][k][l];
for (k=0;k<H;k++)
{
for (l=0;l<W;l++)
{
if (Map[0][k][l]=='R')
{
if (k!=0)
{
if (Map[0][k-1][l]=='P')Map[1][k][l]='P';
if (Map[0][k-1][l]=='S')Map[1][k-1][l]='R';
}
if (l!=0)
{
if (Map[0][k][l-1]=='P')Map[1][k][l]='P';
if (Map[0][k][l-1]=='S')Map[1][k][l-1]='R';
}
if (k!=H-1)
{
if (Map[0][k+1][l]=='P')Map[1][k][l]='P';
if (Map[0][k+1][l]=='S')Map[1][k+1][l]='R';
}
if (l!=W-1)
{
if (Map[0][k][l+1]=='P')Map[1][k][l]='P';
if (Map[0][k][l+1]=='S')Map[1][k][l+1]='R';
}
}
if (Map[0][k][l]=='S')
{
if (k!=0)
{
if (Map[0][k-1][l]=='P')Map[1][k-1][l]='S';
if (Map[0][k-1][l]=='R')Map[1][k][l]='R';
}
if (l!=0)
{
if (Map[0][k][l-1]=='P')Map[1][k][l-1]='S';
if (Map[0][k][l-1]=='R')Map[1][k][l]='R';
}
if (k!=H-1)
{
if (Map[0][k+1][l]=='P')Map[1][k+1][l]='S';
if (Map[0][k+1][l]=='R')Map[1][k][l]='R';
}
if (l!=W-1)
{
if (Map[0][k][l+1]=='P')Map[1][k][l+1]='S';
if (Map[0][k][l+1]=='R')Map[1][k][l]='R';
}
}
if (Map[0][k][l]=='P')
{
if (k!=0)
{
if (Map[0][k-1][l]=='R')Map[1][k-1][l]='P';
if (Map[0][k-1][l]=='S')Map[1][k][l]='S';
}
if (l!=0)
{
if (Map[0][k][l-1]=='R')Map[1][k][l-1]='P';
if (Map[0][k][l-1]=='S')Map[1][k][l]='S';
}
if (k!=H-1)
{
if (Map[0][k+1][l]=='R')Map[1][k+1][l]='P';
if (Map[0][k+1][l]=='S')Map[1][k][l]='S';
}
if (l!=W-1)
{
if (Map[0][k][l+1]=='R')Map[1][k][l+1]='P';
if (Map[0][k][l+1]=='S')Map[1][k][l]='S';
}
}
}
}
}
for (k=0;k<H;k++)cout<<Map[1][k]<<endl;
cout<<endl;
}
return 0;
}
在我的电脑上没问题啊
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator