Business Cards
Moreover,
they require that all the paper (which may not be cheap, but is
definitely not that expensive!) has to be used, i.e. no tiny bit may be
left over.
Moreover, the brilliant idea of cutting the sheet into
very small pieces, and then gluing them together in desired sheets was
laughed at.
An example of a 9 *6 paper sheet divided into 2 * 3 cards is given below.
input contains several test cases. The first line contains the number
of test cases t (t <= 10^5). Then t test cases follow. Each of them
consists of one line containing four integers a, b, c, d (1 <=a, b,
c, d <= 10^9).
Numbers a and b are dimensions of each business card; c and d are dimensions of the paper sheet.
each test case output one line containing word YES if it is possible to
divide the whole sheet into business cards, and NO otherwise.
2 3 9 6
2 3 8 6
2 3 6 8
2 3 5 7
YES
YES
NO
分析:
using namespace std;
bool jud(int a, int b, int z) {
int x = 1;
while(a * x < z) {
if((z - a * x) % b == 0) {
return true;
}
x++;
}
return false;
}
bool judge(int x,int y,int m,int n)
{
if(m % x==0 && n % y==0)
return true;
if(m % y==0 && n % x==0)
return true;
if(m % y==0 && m % x==0 && jud(x,y,n))
return true;
if(n % y==0 && n % x==0 && jud(x,y,m))
return true;
return false;
}
int main()
{
int n;
while(cin>>n)
{
while(n--)
{
int x,y,m,n;
cin>>x>>y>>m>>n;
if(judge(x,y,m,n))
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
}
return 0;
}
Business Cards的更多相关文章
- vCard : a file format standard for electronic business cards
http://zh.wikipedia.org/wiki/VCard vCard是电子名片的文件格式标准.它一般附加在电子邮件之后,但也可以用于其它场合(如在互联网上相互交换). vCard可包含的信 ...
- Business Cards UVALive - 4384(画图看图。。)
只能由三种情况 都横着放 都竖着放 横和竖交错放 那就去判断好了... 具体看代码 #include <iostream> #include <cstdio> #inclu ...
- How to Start a Business in 10 Days
With an executive staffing venture about to open, a business loan from the in-laws gnawing at her co ...
- introduction to my business card
http://www.t4f.org/projects/business-card/ After 4 years working in an international IT consulting c ...
- 50款免费 PSD 名片设计模板源文件下载《下篇》
名片是陌生人之间建立联系的最便捷.最有效的工具.名片它可能是给你的客户留下正面的印象第一步,另一方面,名片是一个企业最重要和最符合成本效益的营销工具之一,尤其是对于刚刚起步的企业.这里收集了50款免费 ...
- 免费 PSD 素材:25个全新的界面设计资源
在这篇文章中,我们给大家收集了25套全新的 UI 设计素材.这些来自优秀设计师的 PSD 源文件素材让其它的设计师们在设计用户界面原型的时候能够非常便利. 网站用户界面,移动应用程序用户界面和对设计师 ...
- 50款免费名片设计模板 PSD 源文件下载《上篇》
名片它可能是给你的客户留下正面的印象第一步,另一方面,名片是一个企业最重要和最符合成本效益的营销工具之一,尤其是对于刚刚起步的企业.这里收集了50款免费的名片设计模板,提供 PSD 源文件下载. 您可 ...
- NFC Forum : Frequently Asked Questions (NFC 论坛:FAQ)
NFC for Business What is the NFC Forum? The NFC Forum is a not-for-profit industry organization whos ...
- RFC3261--sip
本文转载自 http://www.ietf.org/rfc/rfc3261.txt 中文翻译可参考 http://wenku.baidu.com/view/3e59517b1711cc7931b716 ...
随机推荐
- servlet的的生命周期和使用
1 Servlet的生命周期是通过Servlet接口中的init(),service(),和destroy()方法来表示的,即Servlet从创建到销毁的过程.包括如何加载和实例化,初始化,处理请求, ...
- div 自动全屏高度
最近做一个页面,需要一个div自动铺满全屏,但是高度总是难以搞定.查资料为:需要从html body到div 需要 设置 高度属性 为100%
- hadoop无法启动常见原因
1.Could not chdir to home directory /home/USER: Permission denied 启动datanode时会报这个错误,尝试利用ssh登录datanod ...
- Dynomite 安装配置
Dynomite受Dynamo白皮书的启发,是一种用于不同存储引擎和协议的轻量级的分布式的Dynamo层. 目前包括Redis和Memcached. Dynomite支持多数据中心复制,旨在实现高可用 ...
- 两台Linux之间传文件
安装sudo apt-get install openssh-client openssh-server 使用scp命令: scp john@~/hallo.h /usr/include 将左边移动到 ...
- IO模型与select,poll,epoll
五种:阻塞,非阻塞,IO复印,信号驱动,异步. select,poll,epoll select: 典型用32个32位的整数表示1024个描述符,并发的局限. poll:功能同上,但数据结构不一样(链 ...
- 对于局部变量,text、ntext 和 image 数据类型无效
开发存储过程时报如上错误.大多数人说用varchar(8000)代替text,但值我这里超过8000,不可取 解决: sql2005或以上版本支持新数据类型:varchar(max)nvarchar( ...
- appcache的一个特殊用法
Application Cache是HTML5里出现的用来实现离线应用的技术方案.在使用了appcache的页面会被缓存,同时浏览器检查manifest文件有没有变化,如果有变化,只有当用户下次进行访 ...
- CentOS 7安装zabbix步骤
Zabbix配置安装 1.前期准备: 我自己的基础环境:CentOS 7 + Mysql 5.6 可以根据官网介绍一步一步安装,官网地址:https://www.zabbix.com/ 图1: 然后点 ...
- linux下nginx tomcat集群
集群系统一般通过两台或多台节点服务器系统通过相应的硬件及软件互连,每个群集节点都是运行其自己进程的独立服务器. 这些进程可以彼此通信,对网络客户机来说就像是形成了一个单一系统,协同起来向用户提供应用程 ...