CF16A Flag
题意翻译
题目描述
根据一项新的ISO标准,每一个国家的国旗应该是一个n×m的格子场,其中每个格子最多有10种不同的颜色。并且国旗应该有条纹:旗帜的每一行应包含相同颜色的方块,相邻的行的颜色应该是不同的。Berland政府要求你找出他们的国旗是否符合新的ISO标准。
输入格式:
输入的第一行包含数n和m( ( 1<=n,m<=100 ),其中n为行数,m为列数。接下来
是对旗的描述:以下N行中的每一行包含m个字符。每个字符是0到9之间的数字,代表相应正方形的颜色。
输出格式:
如果国旗符合标准就输出YES,否则输出NO。
题目描述
According to a new ISO standard, a flag of every country should have a chequered field n×mn×m , each square should be of one of 10 colours, and the flag should be «striped»: each horizontal row of the flag should contain squares of the same colour, and the colours of adjacent horizontal rows should be different. Berland's government asked you to find out whether their flag meets the new ISO standard.
输入输出格式
输入格式:
The first line of the input contains numbers nn and mm ( 1<=n,m<=1001<=n,m<=100 ), nn — the amount of rows, mm — the amount of columns on the flag of Berland. Then there follows the description of the flag: each of the following nn lines contain mmcharacters. Each character is a digit between 0 and 9, and stands for the colour of the corresponding square.
输出格式:
Output YES, if the flag meets the new ISO standard, and NO otherwise.
输入输出样例
3 3
000
111
002
NO
AC
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n,m;
int map[][];
int main(){
scanf("%d%d",&n,&m);
for(int i=;i<=n;i++){
string s;cin>>s;
for(int j=;j<m;j++)
map[i][j+]=s[j]-'';
}
for(int i=;i<=n;i++){
int now=map[i][];
for(int j=;j<=m;j++)
if(map[i][j]!=now){
cout<<"NO"<<endl;
return ;
}
}
int now=map[][];
for(int i=;i<=n;i++){
if(map[i][]==now){
cout<<"NO"<<endl;
return ;
}
now=map[i][];
}
cout<<"YES"<<endl;
}
CF16A Flag的更多相关文章
- 例如筋斗云的效果,但不通过offset定位的flag标记
效果:mouseenter到li上出现背景图片,mouseleave后背景图片消失,click以后该背景图片被锁定 问题:简单的mouseenter,mouseleave和click事件不能达到预期的 ...
- (转)Intent flag 与启动模式的对应关系
原文地址:http://www.cnblogs.com/ttylinux/p/4069513.html Activity有四种启动模式: 1.standard(标准) 2.singleTop ...
- flag+文件操作
flag标志位,标识位,在其他语言中可能叫开关,个人觉得当作开关更容易理解.下面我们来利用这个开关来控制文件操作的流程,从而优雅的修改配置文件. global log 127.0.0.1 local2 ...
- Activity Intent相关FLAG介绍
先首先简单介绍下Task和Activity的关系 Task就像一个容器,而Activity就相当与填充这个容器的东西,第一个东西(Activity)则会处于最下面,最后添加的东西(Activity ...
- 暑假前的flag
暑假到了,为了简便新开了一个博客,供暑假刷体放一些题解,玩acm1年多了,cf还是蓝名,真是菜的一笔,明年就大三了,马上就要毕业了,然而还是啥也不会,兼职和智障没什么两样,当初大一吹的牛逼说要成为学校 ...
- golang flag包
go flag 包用来解析命令行参数,通过一个简单的例子来了解下 package main import ( "flag" "fmt" ) fu ...
- Android 启动模式及常用的Intent的Flag
LaunchMode 在声明Activity的xml中指定 android:launchMode="xxx" standard 标准模式.这是系统默认的模式,每次启动Activit ...
- BestCoder Round #90 A.Kblack loves flag(随机数生成种子)
A.Kblack loves flag [题目链接]A.Kblack loves flag [题目类型]水题 &题意: kblack喜欢旗帜(flag),他的口袋里有无穷无尽的旗帜. 某天,k ...
- uC/OS-II标志(flag)块
/*************************************************************************************************** ...
随机推荐
- Ajax-URL 防止数据缓存,添加时间戳
url:CONTEXTPATH + "/dataService/getSourceStatics?type=0&t="+new Date().getTime(),
- 使用gridlayout布局后,因某些原因又删除,并整理文件夹结构时,Unable to resolve target 'android-7'
出现的问题 [2013-01-11 10:52:39 - gridlayout_v7] Unable to resolve target 'android-7' 事由:在一次做九宫格时.误使用了gri ...
- Java设计模式透析之 —— 模板方法(Template Method)
今天你还是像往常一样来上班,一如既往地開始了你的编程工作. 项目经理告诉你,今天想在server端添加一个新功能.希望写一个方法.能对Book对象进行处理.将Book对象的全部字段以XML格式进行包装 ...
- Android中XML解析,保存的三种方法
简单介绍 在Android开发中,关于XML解析有三种方式,各自是: SAX 基于事件的解析器.解析速度快.占用内存少.非常适合在Android移动设备中使用. DOM 在内存中以树形结构存放,因此检 ...
- 浅谈for循环
for循环 <script> /* ** (1) 是执行代码块之前 ** (2) 运行代码块的条件 ** (3) 需要执行的代码块 ** (4) 代码块执行后执行 ** 执行顺序是(1)( ...
- POJ 1252 DP
题意:给你6个数.让你求出1~100范围内的数 最优情况下由这六个数加减几步得到. 输出平均值和最大值. 思路: 我就随便写了写,,,感觉自己的思路完全不对. 但是交上去 AC了!!! 我先当减法 不 ...
- Neo4j沙盒实验申请过程步骤(图文详解)
不多说,直接上干货! 参考博客 http://blog.csdn.net/u012318074/article/details/72793632 (对此表示感谢) 前期博客 我暂时是将Neo4j ...
- vue入门--简单路由配置
在初始化vue init webpack <工程名>时,有一步是询问是否安装vue-router,选择yes,如果没有安装的话,后面需要自己安装.然后在目录中可以看到有个文件夹叫route ...
- Django开发之路 二(django的models表查询)
django的models表查询 一.单表查询 (1) all(): 查询所有结果 # 返回的QuerySet类型 (2) filter(**kwargs): 它包含了与所给筛选条件相匹配的对象 #返 ...
- ssh: connect to host port 22: Connection refused
配置Linux的互信,互信完成后,连接需要+端口才可以已经将端口修改为7777,但依旧走的是默认的22端口修改方式:[root@yoon ssh]# vi /etc/servicesssh ...