3/5/2014 cfb 小心
2024-10-15 01:53:07
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;
}
最新文章
- poll机制
- HttpSession--会话
- html中出现的script失效
- 使用TypeScript开发程序
- 利用迅雷提供的接口从磁力链得到bt种子文件
- 在Ubuntu 中安装eclipse, eclipse 文件已经下载好!
- mybatis源代码分析:mybatis延迟加载机制改进
- vc++ ODBC
- UpdataData
- 使用PreListener与InteractionListener的一个小发现
- 融会贯通——最常用的“合成复用原则”技能点Get
- IP协议详解(转)
- Laravel5多图上传和Laravel5单图上传的功能实现
- python基础篇_006_面向对象
- JavaScript大杂烩1 - 理解JavaScript的类型系统
- 5410 ACM 杭电 01+完全背包
- Python并发编程之线程池/进程池--concurrent.futures模块
- 使用 Actuator 监控
- 16_python_面向对象
- linux高精度struct timespec 和 struct timeval
热门文章
- expect小工具,在postgresql中执行sql的shell脚本
- jenkins 集成redmine
- Spark2 Dataset分析函数--排名函数row_number,rank,dense_rank,percent_rank
- poj 2125 Destroying The Graph 最小割+方案输出
- opengl学习笔记(一)
- 2018牛客网暑期ACM多校训练营(第二场) A - run - [DP]
- _cs, _ci, or _bin,
- 2018/04/16 PHP 设计模式之工厂模式
- Java泛型初探
- CentOS 6 网络设置