hdu5319(模拟)
来源:互联网 发布:编程一小时网站 编辑:程序博客网 时间:2024/06/13 12:17
链接:点击打开链接
题意:有两把刷子,红色刷子沿‘\’方向,蓝色刷子沿‘\’方向,先用红色刷子再用蓝色刷子,都刷到的格子为绿色。给出一个矩阵表示最后的状态,求最少需要刷多少次可以达到最后的状态
代码:
#include <vector>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <iostream>#include <algorithm>using namespace std;char s[105][105];int main(){ int t,n,m,i,j,x,y,ans; scanf("%d",&t); while(t--){ scanf("%d",&n); for(i=1;i<=n;i++){ scanf("%s",s[i]+1); m=strlen(s[i]+1); } ans=0; for(i=1;i<=n;i++){ //换一个角度考虑,考虑对每个点来说哪种 for(j=1;j<=m;j++){ //情况不用考虑 if(s[i][j]=='R') if(s[i-1][j-1]!='R'&&s[i-1][j-1]!='G') ans++; if(s[i][j]=='B') if(s[i-1][j+1]!='B'&&s[i-1][j+1]!='G') ans++; if(s[i][j]=='G'){ if(s[i-1][j+1]!='B'&&s[i-1][j+1]!='G') ans++; if(s[i-1][j-1]!='R'&&s[i-1][j-1]!='G') ans++; } } } printf("%d\n",ans); } return 0;}
0 0
- hdu5319(模拟)
- hdu5319 模拟水题
- hdu5319 Painter(模拟)
- hdu5319 Painter(模拟)
- hdu5319 简单模拟
- hdu5319 Painter(模拟题)
- HDU5319
- 2015 多校联赛 ——HDU5319(模拟)
- HDU5319.Painter
- hdu5319 Painter
- hdu5319 Painter
- HDU5319 Painter
- HDU5319 Painter(深搜DFS)
- HDU5319暴力扫加标记
- 解题报告 之 HDU5319 Painter
- hdu5319&hdu多校集训第四题
- hdu5319(求素数+威尔逊定理)
- hdu5319(2015多校3)--Painter(暴力,,,)
- Qt之QFileIconProvider(根据扩展名获取文件图标、类型)
- 马特-福特无奈为何外界对卡特勒评价糟糕
- jQuery获取Select选中的Text和Value,根据Value值动态添加属性等
- 使用ant打包android生成apk文件
- org.springframework.beans.MethodInvocationException: Property 'cacheManager' threw exception; neste
- hdu5319(模拟)
- C++轻量级界面库DuiLib简介(二)—使用DuiLib
- 802.11N blockACK
- Spring 框架简介
- 欢迎使用CSDN-markdown编辑器
- 包含min函数的栈
- 计算机中丢失 msvcr110.dll 怎么办
- Broken pipe 和 connection reset by peer
- Leetcode-gas-station