题意翻译

题目描述

根据一项新的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.

输入输出样例

输入样例#1: 复制

3 3
000
111
222
输出样例#1: 复制

YES
输入样例#2: 复制

3 3
000
000
111
输出样例#2: 复制

NO
输入样例#3: 复制

3 3
000
111
002
输出样例#3: 复制

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的更多相关文章

  1. 例如筋斗云的效果,但不通过offset定位的flag标记

    效果:mouseenter到li上出现背景图片,mouseleave后背景图片消失,click以后该背景图片被锁定 问题:简单的mouseenter,mouseleave和click事件不能达到预期的 ...

  2. (转)Intent flag 与启动模式的对应关系

    原文地址:http://www.cnblogs.com/ttylinux/p/4069513.html Activity有四种启动模式: 1.standard(标准)    2.singleTop   ...

  3. flag+文件操作

    flag标志位,标识位,在其他语言中可能叫开关,个人觉得当作开关更容易理解.下面我们来利用这个开关来控制文件操作的流程,从而优雅的修改配置文件. global log 127.0.0.1 local2 ...

  4. Activity Intent相关FLAG介绍

    先首先简单介绍下Task和Activity的关系   Task就像一个容器,而Activity就相当与填充这个容器的东西,第一个东西(Activity)则会处于最下面,最后添加的东西(Activity ...

  5. 暑假前的flag

    暑假到了,为了简便新开了一个博客,供暑假刷体放一些题解,玩acm1年多了,cf还是蓝名,真是菜的一笔,明年就大三了,马上就要毕业了,然而还是啥也不会,兼职和智障没什么两样,当初大一吹的牛逼说要成为学校 ...

  6. golang flag包

    go flag 包用来解析命令行参数,通过一个简单的例子来了解下 package main import (     "flag"     "fmt" ) fu ...

  7. Android 启动模式及常用的Intent的Flag

    LaunchMode 在声明Activity的xml中指定 android:launchMode="xxx" standard 标准模式.这是系统默认的模式,每次启动Activit ...

  8. BestCoder Round #90 A.Kblack loves flag(随机数生成种子)

    A.Kblack loves flag [题目链接]A.Kblack loves flag [题目类型]水题 &题意: kblack喜欢旗帜(flag),他的口袋里有无穷无尽的旗帜. 某天,k ...

  9. uC/OS-II标志(flag)块

    /*************************************************************************************************** ...

随机推荐

  1. json_encode把中文字符的数组转为json格式

    function ch_json_encode($data) { /** * 将中文编码 * @param array $data * @returnstring */ function ch_url ...

  2. 【转】C# ArcgisEngine开发中,对一个图层进行过滤,只显示符合条件的要素

    有时候,我们要对图层上的地物进行有选择性的显示,以此来满足实际的功能要求. 按下面介绍的方法可轻松实现图层属性过滤显示: 1.当图层已经加载时 private void ShowByFilter(Ax ...

  3. 使用CSStickyHeaderFlowLayout实现头部固定的CollectionView

    近期流行的一种界面效果,是瀑布流的header固定,也叫sticky header或者parallax.对于UITableView,能够比較方便地让table header固定,可是对于UIColle ...

  4. 【1】按照Django官网,编写一个web app 创建project/配置数据库

    1. Creating a project From the command line, cd into a directory where you'd like to store your code ...

  5. JPA实现一对多(OneToMany)关联

    转自:https://blog.csdn.net/qq_32444825/article/details/77084580 1.考试类 @Entity public classExam impleme ...

  6. 使用sed -i对文本字符串进行增删改查

    sed是一个很好的文件处理工具,本身是一个管道命令,主要以行为单位进行处理,可以将数据行进行替换.删除.新增.选取等特定工作.1. sed命令行格式sed [选项] [命令] 1.1 选项-n,使用安 ...

  7. Centos6.5添加Epel和Remi源安装Lamp环境

    想搭建一个Lamp环境,因为编译安装太麻烦,对于我这样的新手来说,太过于复杂.而CentOS自带的Apache.MySql和PHP的版本都太低,不想用.上百度搜了一轮,原来可以通过添加Epel和Rem ...

  8. Redis学习笔记(十一) 命令进阶:Connection(连接)

    原文链接:http://doc.redisfans.com/connection/index.html auth password 有时候处于安全性考虑,我们可以使用密码来保护redis服务器,每次连 ...

  9. ROS-导航功能-RVIZ

    前言:slam使用激光雷达完成了地图构建,现在介绍一下自主导航.move_base用于实现最优路径规划,amcl用于实现机器人定位. 前提:已下载并编译了相关功能包集,如还未下载,可通过git下载:h ...

  10. BZOJ 4321 DP

    思路: 这个DP太神了- 完全没想到 http://blog.csdn.net/geotcbrl/article/details/49663401 //By SiriusRen #include &l ...