FZU - 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
Sample Output
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的更多相关文章
- FZU 2137 奇异字符串 后缀树组+RMQ
题目连接:http://acm.fzu.edu.cn/problem.php?pid=2137 题解: 枚举x位置,向左右延伸计算答案 如何计算答案:对字符串建立SA,那么对于想双延伸的长度L,假如有 ...
- FZU 1914 单调队列
题目链接:http://acm.fzu.edu.cn/problem.php?pid=1914 题意: 给出一个数列,如果它的前i(1<=i<=n)项和都是正的,那么这个数列是正的,问这个 ...
- ACM: FZU 2105 Digits Count - 位运算的线段树【黑科技福利】
FZU 2105 Digits Count Time Limit:10000MS Memory Limit:262144KB 64bit IO Format:%I64d & ...
- FZU 2112 并查集、欧拉通路
原题:http://acm.fzu.edu.cn/problem.php?pid=2112 首先是,票上没有提到的点是不需要去的. 然后我们先考虑这个图有几个连通分量,我们可以用一个并查集来维护,假设 ...
- ACM: FZU 2107 Hua Rong Dao - DFS - 暴力
FZU 2107 Hua Rong Dao Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I6 ...
- ACM: FZU 2112 Tickets - 欧拉回路 - 并查集
FZU 2112 Tickets Time Limit:3000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u P ...
- ACM: FZU 2102 Solve equation - 手速题
FZU 2102 Solve equation Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & ...
- ACM: FZU 2110 Star - 数学几何 - 水题
FZU 2110 Star Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Pr ...
- alibaba fastjson List<Map<String, String>>2Str
import java.util.ArrayList;import java.util.HashMap;import java.util.List;import java.util.Map; impo ...
随机推荐
- 解析HTTP协议六种请求方法
标准Http协议支持六种请求方法,即: 1,GET 2,HEAD 3,PUT 4,DELETE 5,POST 6,OPTIONS 但其实我们大部分情况下只用到了GET和POST.如果想设计一个符合RE ...
- 洛谷P3809 后缀数组模板
题目:https://www.luogu.org/problemnew/show/P3809 刚学了后缀数组,看人家手写演示了半天,大概明白了过程,但完全写不出来代码: 于是借鉴了许多,不过都差不多, ...
- CentOs7 修改rpm安装背景图
http://bbs.chinaunix.net/thread-4166176-1-1.html
- Django day06 模版层(一) 变量和深度查询
一.模版语法之变量: 1 - {{ 变量 }} ******重要*******{#这个相当于print了该变量#} def index(request): name = 'prince' #字符串 ...
- LMS、NLMS最优步长理论分析与Speex回声消除可能的改进想法
一.回声消除算法模型 先来分析下自适应回声消除的主要组成部分,大体上可以把回声消除模型分为两个部分 横向滤波器结构 滤波器系数自适应与步长控制 横向滤波器用脉冲响应w(n)[有的地方也称为回声路径]与 ...
- 如何通过免费开源ERP Odoo实现企业数字化转型深度分析(一)
本文来自<开源智造企业数字化转型报告白皮书>的精选内容章节.请勿转载.欢迎您反馈阅读意见. 引言 在由消费者驱动的数字经济时代,创新之势锐不可挡.变革步伐从未如此迅速,并且还会越来越快.对 ...
- rabbitmq普通集群搭建详细步骤
由于工作需求,需要安装rabbitmq,学习之余,记录一下安装过程 准备基础编译环境yum install gcc glibc-devel make ncurses-devel openssl-dev ...
- F - Modular Exponentiation
Problem description The following problem is well-known: given integers n and m, calculate 2n mod m, ...
- 【PostgreSQL-9.6.3】如何实现非自动提交
我们在使用psql工具操作数据库时,事务是自动提交的.也就是说,当我们执行完一条insert或者delete语句后,在不输入commit情况下,这条语句也是提交的.如果不想自动提交,可以使用以下两种方 ...
- js实现年月日三级联动
当我们注册一个qq的时候,会看到一个三级年月日的联动菜单,下面简单介绍. <!doctype html> <html lang="en"> <head ...