3/5/2014 cfb 小心
2014-03-08 11:22
369 查看
During each move the player can choose all lines of the matrix where dwarf is not on the cell with candy and shout "Let's go!"
这个 看成是 选其所有干行 我却看成是选其中 若干 行 水一下自己
这个 看成是 选其所有干行 我却看成是选其中 若干 行 水一下自己
#include <iostream> #include <cstdio> #include <string.h> #include <algorithm> using namespace std; char map[1005][1005]; int N[1005],L[1005]; int main() { int n,m; while(scanf("%d%d",&n,&m)==2){ bool flag=0; for(int i=0;i<n;i++){ scanf("%s",map[i]); for(int j=0;j<m;j++) if(map[i][j]=='G'){ L[i]=j;break; } } for(int i=0;i<n;i++){ int j; for( j=L[i];j<m;j++)if( map[i][j]=='S'){ N[i]=j-L[i];break; } if(j==m){ flag=1;break;} } if(flag){ printf("-1\n"); } else { int num=1; sort(N,N+n); for(int i=0;i<n-1;i++) if(N[i]!=N[i+1]) num++; printf("%d\n",num); } } return 0; }
相关文章推荐
- 黑马程序员_静态类
- Java学习笔记
- android学习日记0--开发需要掌握的技能
- Yii学习笔记
- net零碎
- 字符序列与字符数组(一)
- MMORPG大型游戏设计与开发(part6 of net)
- 个人密码安全策略
- linux学习笔记
- sql中ORDER SIBLINGS BY排序的含义
- 开放(关闭)端口、防火墙
- Implement strStr()
- START WITH...CONNECT BY PRIOR详解
- UVa 193 - Graph Coloring
- css细节很重要!
- CurrentCulture
- 深入学习JDK 线程池(之一)
- MySQL数据库缓存参数优化
- pat 1031
- LBS-基于位置服务(Location Based Service)