标签:return isa 之一 int clear ++ i++ char pre
#include <iostream> using namespace std; int main() { int r,c,n; char a[101][101],b[101][101]; cin>>r>>c>>n; for(int i=1;i<=r;i++) for(int j=1;j<=c;j++) cin>>a[i][j]; for(int d=1;d<=n;d++) { for(int i=1;i<=r;i++) for(int j=1;j<=c;j++) b[i][j]=a[i][j]; for(int i=1;i<=r;i++) for(int j=1;j<=c;j++) { if(b[i][j]==‘R‘&&(b[i-1][j]==‘P‘||b[i+1][j]==‘P‘||b[i][j-1]==‘P‘||b[i][j+1]==‘P‘)) a[i][j]=‘P‘; else if(b[i][j]==‘S‘&&(b[i-1][j]==‘R‘||b[i+1][j]==‘R‘||b[i][j-1]==‘R‘||b[i][j+1]==‘R‘)) a[i][j]=‘R‘; else if(b[i][j]==‘P‘&&(b[i-1][j]==‘S‘||b[i+1][j]==‘S‘||b[i][j-1]==‘S‘||b[i][j+1]==‘S‘)) a[i][j]=‘S‘; } } for(int i=1;i<=r;i++) { for(int j=1;j<=c;j++) cout<<a[i][j]; cout<<endl; } return 0; }
标签:return isa 之一 int clear ++ i++ char pre
原文地址:https://www.cnblogs.com/fangzheng-nie/p/9945951.html