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)块
/*************************************************************************************************** ...
随机推荐
- linux 下 The valid characters are defined in RFC 7230 and RFC 3986
换tomcat 8.0.38就ok . 下载地址: http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.38/bin/apache-tomcat-8 ...
- [GraphQL] Mutations and Input Types
Sometimes, you want to resues object type when doing mutation, you can use 'input' type to help: inp ...
- php中的self关键字和this关键字的区别和联系
php中的self关键字和this关键字的区别和联系 面向对象编程(OOP,Object OrientedProgramming)现已经成为编程人员的一项基本技能.利用OOP的思想进行PHP的高级编程 ...
- ES JVM使用如果超过75%就会GC较多,导致ES索引性能下降
转自:https://www.elastic.co/guide/en/cloud/current/ec-metrics-memory-pressure.html Scenario: How Does ...
- 【IOI 2011】Race
[题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=2599 [算法] 点分治 [代码] #include<bits/stdc++.h ...
- ThinkPHP5+Redis单例型购物车
<?php /** * Redis + 单例型购物车 * param $basket 存储商品信息 * param $ins 存储实例化对象 */ namespace lib; use redi ...
- WSL初体验
Windows10 新增加了WSL子系统, 体验了一下感觉还不错... 开启对应的功能后, 在商店里选择安装Ubuntu就可以了. 迁移文件系统 WSL 的文件系统位于 C 盘,当安装的软件越来越 ...
- Spring mvc 实现jsonp和json数据类型
在使用springmvc开发rest接口的时候很方便,可以直接使用@ResponseBody注解,直接加在springmvc的控制器类的方法上,springmvc会直接为我们将返回的对 ...
- SpringMVC+uploadify3.2.1版实现附件上传功能(直接可以使用)
<link rel="stylesheet" type="text/css" href='<c:url value="/uploadify ...
- UDP协议总结
我们已经讲解了物理层.连接层和网络层.最开始的连接层协议种类繁多(Ethernet.Wifi.ARP等等).到了网络层,我们只剩下一个IP协议(IPv4和IPv6是替代关系).进入到传输层(trans ...