#include <iostream>
#include <algorithm>
#define MAXN 205
using namespace std; char _m[MAXN][MAXN]; char tem[MAXN][MAXN]; bool cmp(char a,char b); int r; int c; void fun(); bool cmp(char a,char b); int main()
{
//freopen("acm.acm","r",stdin);
int i;
int j;
int test;
int a = ;
cin>>test; int time;
while(test --)
{
if(a != )
cout<<endl;
cin>>r>>c>>time;
a = ;
for(i = ; i < r; ++ i)
{
for(j = ; j < c; ++ j)
{
cin>>_m[i][j];
}
}
for(i = ; i < r; ++ i)
{
for(j = ; j < c; ++ j)
{
tem[i][j] = _m[i][j];
}
}
for(i = ; i < time; ++ i)
{
fun();
}
for(i = ; i < r; ++ i)
{
for(j = ; j < c; ++ j)
{
cout<<_m[i][j];
}
cout<<endl;
} } } void fun()
{
int i;
int j;
for(i = ; i < r; ++ i)
{
for(j = ; j < c; ++ j)
{
if(i + < r)
{
if(cmp(_m[i+][j],_m[i][j]))
{
tem[i][j] = _m[i+][j];
continue;
}
}
if(j + < c)
{
if(cmp(_m[i][j+],_m[i][j]))
{
tem[i][j] = _m[i][j+];
continue;
}
}
if(i - >= )
{
if(cmp(_m[i-][j],_m[i][j]) )
{
tem[i][j] = _m[i-][j];
continue;
}
}
if(j - >= )
{
if(cmp(_m[i][j-],_m[i][j]))
{
tem[i][j] = _m[i][j-];
continue;
}
}
}
} for(i = ; i < r; ++ i)
{
for(j = ; j < c; ++ j)
{
_m[i][j] = tem[i][j];
}
} } bool cmp(char a,char b)
{
if(a == 'R' && b == 'S')
{
return true;
}
else if(a == 'R' && b == 'P')
{
return false;
}
else if(a == 'P' && b == 'R')
{
return true;
}
else if(a == 'P' && b == 'S')
{
return false;
}
else if(a == 'S' && b == 'P')
{
return true;
}
else if(a == 'S' && b == 'R')
{
return false;
}
return false;
}

POJ 2339的更多相关文章

  1. POJ - 2339 Rock, Scissors, Paper

    初看题目时就发了个错误,我因为没有耐心看题而不了解题目本身的意思,找不到做题的突破口,即使看了一些题解,还是没有想到方法. 后来在去问安叔,安叔一语道破天机,问我有没有搞清题目的意思,我才恍然大悟,做 ...

  2. POJ 题目分类(转载)

    Log 2016-3-21 网上找的POJ分类,来源已经不清楚了.百度能百度到一大把.贴一份在博客上,鞭策自己刷题,不能偷懒!! 初期: 一.基本算法: (1)枚举. (poj1753,poj2965 ...

  3. (转)POJ题目分类

    初期:一.基本算法:     (1)枚举. (poj1753,poj2965)     (2)贪心(poj1328,poj2109,poj2586)     (3)递归和分治法.     (4)递推. ...

  4. poj分类

    初期: 一.基本算法:      (1)枚举. (poj1753,poj2965)      (2)贪心(poj1328,poj2109,poj2586)      (3)递归和分治法.      ( ...

  5. poj 题目分类(1)

    poj 题目分类 按照ac的代码长度分类(主要参考最短代码和自己写的代码) 短代码:0.01K--0.50K:中短代码:0.51K--1.00K:中等代码量:1.01K--2.00K:长代码:2.01 ...

  6. POJ题目分类(按初级\中级\高级等分类,有助于大家根据个人情况学习)

    本文来自:http://www.cppblog.com/snowshine09/archive/2011/08/02/152272.spx 多版本的POJ分类 流传最广的一种分类: 初期: 一.基本算 ...

  7. POJ题目分类(转)

    初期:一.基本算法:     (1)枚举. (poj1753,poj2965)     (2)贪心(poj1328,poj2109,poj2586)     (3)递归和分治法.     (4)递推. ...

  8. POJ题目细究

    acm之pku题目分类 对ACM有兴趣的同学们可以看看 DP:  1011   NTA                 简单题  1013   Great Equipment     简单题  102 ...

  9. POJ题目(转)

    http://www.cnblogs.com/kuangbin/archive/2011/07/29/2120667.html 初期:一.基本算法:     (1)枚举. (poj1753,poj29 ...

随机推荐

  1. 使用reactjs做一个CRUD功能

    第一步:引入reactjs所依赖的js文件,本案例使用的是bootstrap前端框架,所以引入了相应的js和css文件 第二步:body里面添加两个div 第三步:开始编写reactjs脚本 < ...

  2. 2018.07.18 HAOI2009 逆序对数列(线性dp)

    传送门 目前只会n2" role="presentation" style="position: relative;">n2n2的dp" ...

  3. hdu-1251(string+map)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1251 思路:重点是用gets输入,而且用a[20],不能直接输入string类型的. #include ...

  4. 解决yum安装时 Cannot retrieve repository metadata (repomd.xml) for repository

    打开/etc/yum.repos.d/CentOS6-Base-163.repo 将下面的baseUrl的地址换成网上最新 # CentOS-Base.repo## The mirror system ...

  5. FIR IP

    (1)多通道系数处理 系数的格式 (1)       每组系数的长度必须一样长: (2)多组系数依次连接即可; 添加多组系数后会,FIR IP核在生成时会多出以下几个信号 .s_axis_config ...

  6. (dp)Tickets --HDU --1260

    链接: http://acm.hdu.edu.cn/showproblem.php?pid=1260 http://acm.hust.edu.cn/vjudge/contest/view.action ...

  7. MeshLab编译理解

    1.安装QT5.7,VS2013,QT_VA_Addin (涉及3D模型处理,采用64bit编译,且分为两种debug,release方式) 2.下载VCGlib库,放在meshlab的同级目录 (因 ...

  8. [翻译]Writing Custom Wizards 编写自定义的向导

    Writing Custom Wizards  编写自定义的向导   You can extend FastReport's functionality with the help of custom ...

  9. Python学习-4.Python的模块加载(二)

    1.部分函数加载 from SameFolder import printSameFolder printSameFolder() 该代码指从SameFolder.py中加载printSameFold ...

  10. RequestHelper

    Request["param"] 全部 Request.QueryString["param"] get Request.Form["param&qu ...