先上题目:

Problem 1601 Alibaba's treasures

Accept: 332    Submit: 636
Time Limit: 1000 mSec    Memory Limit : 32768 KB

 Problem Description

In the story of “Alibaba and forty robbers”, Alibaba uses his clever wit to overcome the ferocious enemy, and inherits the huge treasure. There are many treasures which is the rectangular net made by pearls, using silver strand to connect each other. Alibaba would like to cut some number of silver strand to make a pearl necklace. Your question is, given the size of pearls net, can Alibaba cut some of silver strand without wasting a pearl to make a pearl necklace(you can wear it in your neck)?

 Input

The first line is a positive number C (C <= 1000), which is the number of test data. The following C lines, each line has two positive integers, M, N, represent the pearls net’s height and width respectively, the two integer are separated by a space. (1 <= M <= 1000, 1 <= N <= 1000).

 Output

If we can cut some of silver strand without wasting a pearl to make a pearl necklace, output “Yes”, otherwise output “No”.

 Sample Input

2
1 1
4 6

 Sample Output

No
Yes

 Hint

There is a way to cut the net when M=4 and N=6.

  题意:给你一个n*m的矩阵,分成n*m个小正方形,问能不能从一个边和边的交点出发,每个交点经过一次,最终回到起点。

  找规律,只要有一条边是偶数的时候就可以满足条件,除非另一条边是1,只要有一条边是1的话那就不可以形成回路。

上代码:

 1 #include <cstdio>
 2
 3 using namespace std;
 4
 5 int main()
 6 {
 7     int n,a,b,s;
 8     //freopen("data.txt","r",stdin);
 9     scanf("%d",&n);
10     while(n--){
11         scanf("%d %d",&a,&b);
12         s=a*b;
13         if(s%2==0 && a!=1 && b!=1) printf("Yes\n");
14         else printf("No\n");
15     }
16     return 0;
17 }

1601

转载于:https://www.cnblogs.com/sineatos/p/3564994.html

FZU - 1601 - Alibaba's treasures相关推荐

  1. Alibaba Cloud Linux 2.1903 LTS 64位服务器yum源下载404,Alibaba Cloud Linux 2实例中使用docker-ce、epel等YUM源安装软件失败

    [Alibaba Cloud Linux 2.1903 LTS 64位]服务器yum源下载404 failure: repodata/repomd.xml from docker-ce-stable: ...

  2. SpringCloud Alibaba微服务实战(七) - 路由网关(Gateway)全局过滤

    说在前面 全局过滤器作用于所有的路由,不需要单独配置,我们可以用它来实现很多统一化处理的业务需求,比如权限认证,IP 访问限制,监控,限流等等. 创建路由网关(Gateway)启动服务cloud-ac ...

  3. SpringCloud Alibaba微服务实战(五) - Sentinel实现限流熔断

    什么是Sentinel? 请查看文章:SpringCloud Alibaba微服务实战(一) - 基础环境搭建 构建服务消费者cloud-sentinel进行服务调用 服务创建请查看文章:Spring ...

  4. SpringCloud Alibaba微服务实战(四) - Nacos Config 配置中心

    说在前面 Nacos 是阿里巴巴开源的一个更易于构建云原生应用的动态服务发现.配置管理和服务管理平台.Nacos Config就是一个类似于SpringCloud Config的配置中心. 一.启动N ...

  5. SpringCloud Alibaba微服务实战(三) - Nacos服务创建消费者(Feign)

    什么是Feign Feign 是一个声明式的伪 Http 客户端,它使得写 Http 客户端变得更简单.使用 Feign,只需要创建一个接口并注解.它具有可插拔的注解特性,可使用 Feign 注解和 ...

  6. SpringCloud Alibaba微服务实战(二) - Nacos服务注册与restTemplate消费

    说在前面 基础环境搭建,理论,请看上一篇,在这就不扯理论了,直接上代码. 项目结构 代码实现 第一步:在父pom的项目中引入dependencyManagement 在引入父pom之前咱们先来回顾下d ...

  7. SpringCloud Alibaba微服务实战(一) - 基础环境搭建

    说在前面 Spring Cloud Alibaba 致力于提供微服务开发的一站式解决方案.此项目包含开发分布式应用微服务的必需组件,方便开发者通过 Spring Cloud 编程模型轻松使用这些组件来 ...

  8. Druid数据库连接池超时问题com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 1000, active 10

    问题描述: com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 1000, active 10at com.alibab ...

  9. Spring Cloud Alibaba基础教程:使用Nacos实现服务注册与发现

    自Spring Cloud Alibaba发布第一个Release以来,就备受国内开发者的高度关注.虽然Spring Cloud Alibaba还没能纳入Spring Cloud的主版本管理中,但是凭 ...

  10. 1命名规则 sentinel_Spring Cloud Alibaba 整合 Sentinel 流控

    前面我们都是直接通过集成sentinel的依赖,通过编码的方式配置规则等.对于集成到Spring Cloud中阿里已经有了一套开源框架spring-cloud-alibaba,就是用于将一系列的框架成 ...

最新文章

  1. 2018-4-7 差分进化算法
  2. 华为服务器显示403,禁止访问403是什么意思 网页提示403怎么解决
  3. Java定时器Timer
  4. 《Fabric 云存储的电子健康病历系统》(3)病历结构体API
  5. (十)Spring 与 MVC 框架整合
  6. java 请求url 返回数据_java后台发起get请求获取响应数据|chu
  7. Javaslang 3.0之路
  8. JQuery DataTables 列自己定义数据类型排序
  9. mysql索引红黑联盟_MySQL的索引
  10. 李江涛:使用Sakai构建开放式教学平台
  11. 异步电机matlab仿真 推荐 辅导书,异步电机模型Matlab仿真
  12. BH1750 STM32 驱动程序
  13. QQ也出网页版的了- WebQQ公测中
  14. 【笔记】识别手写数字神经网络
  15. OpenCV快速入门篇(Python实现)
  16. C语言自定义函数的调用
  17. React 生命周期总结(新旧对比)
  18. 【无人机组装与调试】第四章 F450四轴装机实例-选择机型、需要的器材工具材料
  19. 性能测试篇-通过shell脚本优化iozone测试硬盘读写性能
  20. vue JsBarcode 常用参数设置

热门文章

  1. 打仗最害怕的是什么?后方出事
  2. 机场也应该取个好听的名
  3. 2021年高考成绩查询梧州市,2021年梧州高考状元是谁分数多少分,历年梧州高考状元名单...
  4. 镜像电流源特点_电流源传奇——镜之分身
  5. php判断长度函数是,php判断字符串长度 strlen()与mb_strlen()函数
  6. mapreduce实现——腾讯大数据QQ共同好友推荐系统【你可能认识的人】
  7. Spring boot admin 使用
  8. UIView animateWithDuration 使用详解
  9. Entity Framework 延伸系列目录
  10. Asp.net 后台添加Meta标签方法