先上题目:

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的话那就不可以形成回路。

上代码:

 #include <cstdio>

 using namespace std;

 int main()
{
int n,a,b,s;
//freopen("data.txt","r",stdin);
scanf("%d",&n);
while(n--){
scanf("%d %d",&a,&b);
s=a*b;
if(s%== && a!= && b!=) printf("Yes\n");
else printf("No\n");
}
return ;
}

1601

FZU - 1601 - Alibaba's treasures的更多相关文章

  1. FZU 2137 奇异字符串 后缀树组+RMQ

    题目连接:http://acm.fzu.edu.cn/problem.php?pid=2137 题解: 枚举x位置,向左右延伸计算答案 如何计算答案:对字符串建立SA,那么对于想双延伸的长度L,假如有 ...

  2. FZU 1914 单调队列

    题目链接:http://acm.fzu.edu.cn/problem.php?pid=1914 题意: 给出一个数列,如果它的前i(1<=i<=n)项和都是正的,那么这个数列是正的,问这个 ...

  3. ACM: FZU 2105 Digits Count - 位运算的线段树【黑科技福利】

     FZU 2105  Digits Count Time Limit:10000MS     Memory Limit:262144KB     64bit IO Format:%I64d & ...

  4. FZU 2112 并查集、欧拉通路

    原题:http://acm.fzu.edu.cn/problem.php?pid=2112 首先是,票上没有提到的点是不需要去的. 然后我们先考虑这个图有几个连通分量,我们可以用一个并查集来维护,假设 ...

  5. ACM: FZU 2107 Hua Rong Dao - DFS - 暴力

    FZU 2107 Hua Rong Dao Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I6 ...

  6. ACM: FZU 2112 Tickets - 欧拉回路 - 并查集

     FZU 2112 Tickets Time Limit:3000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u P ...

  7. ACM: FZU 2102 Solve equation - 手速题

     FZU 2102   Solve equation Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & ...

  8. ACM: FZU 2110 Star - 数学几何 - 水题

     FZU 2110  Star Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u  Pr ...

  9. alibaba fastjson List<Map<String, String>>2Str

    import java.util.ArrayList;import java.util.HashMap;import java.util.List;import java.util.Map; impo ...

随机推荐

  1. jQuery总结03

    1 控制网页元素属性和样式的 jQuery 方法有哪些? 2 利用 jQuery 插入网页节点的方法有哪些? 3 jQuery 中绑定事件是什么,如何解除绑定? 4 jQuery 中的动画效果包括哪些 ...

  2. 清橙A1206.小Z的袜子 && CF 86D(莫队两题)

    清橙A1206.小Z的袜子 && CF 86D(莫队两题) 在网上看了一些别人写的关于莫队算法的介绍,我认为,莫队与其说是一种算法,不如说是一种思想,他通过先分块再排序来优化离线查询问 ...

  3. 【撸码caffe 五】数据层搭建

    caffe.cpp中的train函数内声明了一个类型为Solver类的智能指针solver: // Train / Finetune a model. int train() { -- shared_ ...

  4. B1218 [HNOI2003]激光炸弹 dp

    这个题其实打眼一看就知道差不多是dp,而且基本确定是前缀和.然后硬钢就行了...直接暴力预处理前缀和,然后直接dp就行. 题干: Description 一种新型的激光炸弹,可以摧毁一个边长为R的正方 ...

  5. 操作系统-虚拟机-百科:VM

    ylbtech-操作系统-虚拟机-百科:VM 虚拟机(Virtual Machine)指通过软件模拟的具有完整硬件系统功能的.运行在一个完全隔离环境中的完整计算机系统. 虚拟系统通过生成现有操作系统的 ...

  6. ks shell OpenStack 封装

  7. [Apple开发者帐户帮助]四、管理密钥(2)获取密钥标识符

    创建JSON Web令牌(JWT)以与启用的服务进行通信时,需要密钥标识符. 获取密钥标识符 在“ 证书,标识符和配置文件”中,选择侧栏中“键”下的“全部”. 在右侧,选择私钥. 密钥标识符显示在密钥 ...

  8. NPOI导出Excel自动计算公式问题

    以前用过sheet.ForceFormulaRecalculation = true;当时能够自动计算出来. 今天把模板改了一下(没动公式,但是模板是老板改的,我也不知道他操作了什么),结果就不能自动 ...

  9. Spring Boot (7) JdbcTemplate访问数据库

    使用jdbcTemplate操作数据库 spring framework对数据库的操作在jdbc上面做了深层次的封装,通过依赖注入功能,可以将datasource注册到jdbcTemplate中,学习 ...

  10. python--7、面向对象

    什么是面向对象 对象,即抽象的一类事物中的某个具体的个体.这个世界中存在的一切皆为对象,不存在的也能创建出来. 较之面向过程的区别: 编程的复杂度远高于面向过程,不了解面向对象而立即上手基于它设计程序 ...