下午上数据结构,结果竟然没有新题。T T果断上OJ来水一发

ZOJ 2850   Beautiful Meadow

传送门http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2850

题目判断yes的条件为

不是所有的格子都是草地,并且相邻不能没有草地。

#include<cstdio>
#include<iostream>
using namespace std;
const int MAXN=12;
int area[MAXN][MAXN];
int N,M; bool ok()
{
for(int i=0;i<N;i++)
{
for(int j=0;j<M;j++)
{ // cout<<area[i][j]<<" "<<area[i+1][j]<<endl; if(i>0 && area[i-1][j]==0 && area[i][j]==0)
return 0;
if(j>0 && area[i][j-1]==0 && area[i][j]==0)
return 0;
if(i<N-1 && area[i+1][j]==0 && area[i][j]==0)
return 0;
if(j<M-1 && area[i][j+1]==0 && area[i][j]==0)
return 0; } }
return true;
} int main()
{ while(scanf("%d%d",&N,&M),N||M)
{
bool allone=true; for(int i=0;i<N;i++)
{
for(int j=0;j<M;j++)
{
scanf("%d",&area[i][j]);
if(area[i][j]==0)
allone=false;
}
} if( !allone && ok())
printf("Yes\n");
else
printf("No\n");
}
}

ZOJ 1414 Number Steps

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1414

找x和y的关系就好

#include<cstdio>
int main()
{
int N;
scanf("%d",&N);
while(N--)
{
int x,y;
scanf("%d%d",&x,&y);
if(x-y==2 || x==y)
{
if(x%2==0)
printf("%d\n",x+y);
else
printf("%d\n",x+y-1); }
else
printf("No Number\n");
}
}

ZOJ 2850和ZOJ 1414的更多相关文章

  1. zoj 2850 Beautiful Meadow

    Beautiful Meadow Time Limit: 2 Seconds      Memory Limit: 65536 KB Tom's Meadow Tom has a meadow in ...

  2. ZOJ 2723 Semi-Prime ||ZOJ 2060 Fibonacci Again 水水水!

    两题水题: 1.如果一个数能被分解为两个素数的乘积,则称为Semi-Prime,给你一个数,让你判断是不是Semi-Prime数. 2.定义F(0) = 7, F(1) = 11, F(n) = F( ...

  3. ZOJ 3910 Market ZOJ Monthly, October 2015 - H

    Market Time Limit: 2 Seconds      Memory Limit: 65536 KB There's a fruit market in Byteland. The sal ...

  4. ZOJ 3905 Cake ZOJ Monthly, October 2015 - C

    Cake Time Limit: 4 Seconds      Memory Limit: 65536 KB Alice and Bob like eating cake very much. One ...

  5. ZOJ 3903 Ant ZOJ Monthly, October 2015 - A

    Ant Time Limit: 1 Second      Memory Limit: 32768 KB There is an ant named Alice. Alice likes going ...

  6. Zoj 3781(构造)

    Zoj 3781(构造) Zoj 3781 As we all know, Coach Gao is a talented chef, because he is able to cook M dis ...

  7. Google, FaceBook, Amazon 加州求职记 (转)

    http://blog.csdn.net/ithomer/article/details/8774006 http://www.myvisajobs.com 一年多前,出于显而易见的原因,下定决心肉身 ...

  8. 各大oj题目分类(转)

    POJ题目分类 | POJ题目分类 | HDU题目分类 | ZOJ题目分类 | SOJ题目分类 | HOJ题目分类 | FOJ题目分类 | 模拟题: POJ1006POJ1008POJ1013POJ1 ...

  9. ZOJ 1414:Number Steps

    Number Steps Time Limit: 2 Seconds      Memory Limit: 65536 KB Starting from point (0,0) on a plane, ...

随机推荐

  1. 1.STL list

    初始化一个链表 list<,,,, }; 链表排序 mylist.sort(); 链表反转 mylist.reverse(); 链表删除头部和尾部 mylist.pop_back();//删除尾 ...

  2. 手机端使用rem的适配

    <html> <body> <!-- http://www.w3cfuns.com/notes/29143/79dafb7c07f6865f435af641869d312 ...

  3. Spark scheduler

    触发Spark scheduler的入口是调用者代码中的action操作,如groupByKey,first,take,foreach等操作.这些action操作最终会调用SparkContext.r ...

  4. deep-in-es6(七)

    Symbols对象 JavaScript的第七种原始类型 以前的数据类型: Undefined 未定义 Null 空值 Boolean 布尔类型 Number 数字类型 String 字符串类型 Ob ...

  5. 高速数论变换(NTT)

    今天的A题.裸的ntt,但我不会,于是白送了50分. 于是跑来学一下ntt. 题面非常easy.就懒得贴了,那不是我要说的重点. 重点是NTT,也称高速数论变换. 在非常多问题中,我们可能会遇到在模意 ...

  6. 4.使用 WSDL 指定的标准 SOAP 消息格式

    转自:https://technet.microsoft.com/zh-cn/sysinternals/x2ccke44(v=vs.94) 为 XML 文档(定义 Web 服务)定义架构的行业标准 W ...

  7. 1.3 Quick Start中 Step 7: Use Kafka Connect to import/export data官网剖析(博主推荐)

    不多说,直接上干货! 一切来源于官网 http://kafka.apache.org/documentation/ Step 7: Use Kafka Connect to import/export ...

  8. Objective-C基础笔记(7)Foundation中的常用结构体

    一.NSRange NSRange的定义: typedef struct _NSRange { NSUInteger location; NSUInteger length; } NSRange; N ...

  9. Vue render: h => h(App) $mount

    $mount()手动挂载 当Vue实例没有el属性时,则该实例尚没有挂载到某个dom中: 假如需要延迟挂载,可以在之后手动调用vm.$mount()方法来挂载.例如: new Vue({ //el: ...

  10. BZOJ2806: [Ctsc2012]Cheat(广义后缀自动机,单调队列优化Dp)

    Description Input 第一行两个整数N,M表示待检查的作文数量,和小强的标准作文库的行数接下来M行的01串,表示标准作文库接下来N行的01串,表示N篇作文 Output N行,每行一个整 ...