先上题目:

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. 树形 DP 总结

    树形 DP 总结 本文转自:http://blog.csdn.net/angon823/article/details/52334548 介绍 1.什么是树型动态规划 顾名思义,树型动态规划就是在“树 ...

  2. 【BZOJ 1590】 Secret Message

    [题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=1590 [算法] 字典树 [代码] #include<bits/stdc++.h ...

  3. openstack 性能优化极致

  4. Ionic学习记录(一):ionic及cordova安装、创建第一个应用、项目结构

    目录: 一.ionic的安装 二.创建第一个应用程序 三.浏览器中预览应用 四.项目结构 五.添加页面 一.ionic的安装 使用Ionic创建和开发应用程序主要通过Ionic命令行实用程序(“CLI ...

  5. BZOJ 3831 单调队列DP

    思路: 这好像是我刚学单调性的时候做的题 (我是不会告诉你 我被这题教做人了的...) i-stk[head]>k 删队头 f[stk[tail]]>f[i]||(f[stk[tail]] ...

  6. Y - Anton and Letters

    Problem description Recently, Anton has found a set. The set consists of small English letters. Anto ...

  7. C#之考勤系统

    闲来无聊,搞搞C#,下面就是我写的一个Demo 员工类 using System; using System.Collections.Generic; using System.Linq; using ...

  8. Struts2 在登录拦截器中对ajax请求的处理

    前言: 由于ajax请求不像http请求,可以直接进行页面跳转,你返回的所有东西,ajax都只会识别为一个字符串. 之前尝试的方法是在拦截器中返回一个标识给ajax,然后再在每一个ajax请求成功之后 ...

  9. MEF编程模型

    Contract由Contract name和Contract type组成,Contract两个参数可以省略可以implicit也可以explicit,implicit时name和type会自动推断 ...

  10. Laravel5.1 学习笔记2, 路由

    安装的说明请看文档, laravel 安装 #基本路由 你将在 app/Http/routes.php 文件定义大部分路由, 这些路由将被App\Providers\RouteServiceProvi ...