HDU 5319 Painter
2016-07-23 16:13
411 查看
HDU-5319
题意:画家每次只会画\ 或 /,并且用 R 画\ 用B 画/。如果一个点被BR都涂过,就会变成G。给出一张被画完的图,求它被画了几下。解题思路:遇到B或G时判断它右上角是不是B或者G,如果都不是就代表要从这个点开始画一笔。R或G时判断左上角。
/************************************************************************* > File Name: 0722e.cpp > Author: Narsh > > Created Time: 2016年07月22日 星期五 19时52分37秒 ************************************************************************/ #include <iostream> #include <algorithm> #include <cstdio> #include <cstring> using namespace std; int n,t,tot,m; string s[300]; int main() { scanf("%d\n",&t); s[0]=" "; while (t--) { scanf("%d\n",&n); for (int i = 1; i <= n; i++) cin>>s[i]; m=s[1].length(); for (int i = 1; i <= n; i++) { s[i]=" "+s[i]; // cout<<s[i]<<endl; } tot=0; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) if (s[i][j] == 'G' || s[i][j]=='R') if (!(s[i-1][j-1] == 'R' || s[i-1][j-1] == 'G')) tot++; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) if (s[i][j] == 'G' || s[i][j] == 'B') if (!(s[i-1][j+1] == 'B' || s[i-1][j+1] == 'G')) tot++; printf("%d\n",tot); } }
相关文章推荐
- hdu 5732 subway(2016 Multi-University Training Contest 1 1010)
- 【杭电1789】Doing Homework again贪心(还不太懂)
- Raising Modulo Numbers
- Raising Modulo Numbers poj 1995
- 【poj1995】Raising Modulo Numbers
- Trailing Zeroes (III)(n!后有多少零+二分)
- POJ -1995 Raising Modulo Numbers
- 【POJ】-1995-Raising Modulo Numbers(快速幂,同余定理)
- HDU 1789 Doing Homework again
- ailed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test)
- POJ - 1995 Raising Modulo Numbers 【快速幂】
- hdu 5745 La Vie en rose(2016 Multi-University Training Contest 2——暴力)
- 2016 Multi-University Training Contest 1 1005 Necklace (hdu5727)【枚举+匹配】
- poj Raising Modulo Numbers 【快速幂 + 模取余】
- Contains Duplicate II
- 调用http://apistore.baidu.com网站的接口
- HDU5728 2016 Multi-University Training Contest 1 (递归+欧拉函数)
- http://blog.csdn.net/mindfloating/article/details/51534289
- UVA 11076-Add Again
- soft raid5阅读笔记之十四--resync和recovery的区别