先上题目:

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. luogu2085 最小函数值

    题目大意 有n个函数,分别为F1,F2,...,Fn.定义Fi(x)=Ai*x^2+Bi*x+Ci (x,Ai,Bi,Ci∈N*).给定这些Ai.Bi和Ci,请求出所有函数的所有函数值中最小的m个. ...

  2. oc33--构造方法2

    // Person.h #import <Foundation/Foundation.h> @interface Person : NSObject @property int age; ...

  3. public static float CompareExchange(ref float location1,float value,float comparand)

    https://msdn.microsoft.com/en-us/library/k9hz8w9t(v=vs.110).aspx Compares two single-precision float ...

  4. poj 1741(树的点分治)

    Tree Give a tree with n vertices,each edge has a length(positive integer less than 1001). Define dis ...

  5. UESTC--1251--谕神的密码(贪心)

     谕神的密码 Time Limit: 1000MS   Memory Limit: 65535KB   64bit IO Format: %lld & %llu Submit Status ...

  6. 1961 躲避大龙(dfs)

    1961 躲避大龙  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 钻石 Diamond     题目描述 Description 你早上起来,慢悠悠地来到学校门口,发现已经是 ...

  7. Hadoop一主一从部署(2)

    Hadoop部署一主一从(2) 1.关闭防火墙和Linux守护进程 执行命令: iptables -F setenforce 0 2.对Hadoop集群进行初始化,在namenode(主机)上执行命令 ...

  8. CSS画各种二维图形

    1.效果 2.源码 <%@ page contentType="text/html;charset=UTF-8" language="java" %> ...

  9. 努比亚 N2(Nubia NX575J) 解锁BootLoader 并进入临时recovery ROOT

    工具下载链接:https://pan.baidu.com/s/1jJoK2Yq 备用下载链接:https://pan.baidu.com/s/1snjwLdz 密码:71rg 本篇教程教你如何傻瓜式解 ...

  10. 《java数据结构与算法》系列之“简单排序"-冒泡,选择,插入

    好几天又没写,因为这几天很闲,平时忙的时候自己再累都不会睡着,但是呢这没事了,照理说应该是不瞌睡了,结果还睡着了. 所以说,人很贱.也验证了一句话,没有目标的人其实最无聊.人一定要有自己的工作,这工作 ...