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 ...
随机推荐
- asp.net core in centos
CentOS 7部署ASP.NET Core应用程序 看了几篇大牛写的关于Linux部署ASP.NET Core程序的文章,今天来实战演练一下.2017年最后一个工作日,提前预祝大家伙元旦快乐.不 ...
- java作用域public ,private ,protected 及不写时的区别
说明部分转自:http://yangmingjiayou.iteye.com/blog/151865 在说明这四个关键字之前,我想就class之间的关系做一个简单的定义,对于继承自己的class,ba ...
- KNN识别手写数字
一.问题描述 手写数字被存储在EXCEL表格中,行表示一个数字的标签和该数字的像素值,有多少行就有多少个样本. 一共42000个样本 二.KNN KNN最邻近规则,主要应用领域是对未知事物的识别,即判 ...
- twitter 等网站console.log不能使用,可用alert或者
function setConsole() { var iframe = document.createElement('iframe'); iframe.style.display = 'none' ...
- 绘制pathway富集散点图
本文转载自http://www.omicshare.com/forum/forum.php?mod=viewthread&tid=146&extra=page%3D1%26filter ...
- zg 作业一
作业一: 将xxjjT01增加窗体及按钮(增.修.删) 表单(form1.html) 设定按钮作业,授权 1.新增:XXJJT01+CREATE 2.修改:XXJJT01+UPDATE 3.删除:XX ...
- 'org.hibernate.SQLQuery' is deprecated
'org.hibernate.SQLQuery' is deprecated 在Hibernate5.2之后,SQLQuery已经被摒弃,改用NativeQuery代替了. 在Hibernate中使用 ...
- linux、centos下查看系统版本、bios版本,内存信息等
1.查看系统版本 [root@localhost ~]# more /etc/issueCentOS release 6.2 (Final)Kernel \r on an \m 2.查看CPU信息 : ...
- Dungeon Game (GRAPH - DP)
QUESTION The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a ...
- 两个应用之间传递广播的规则 Broadcast
sendBroadcast(new Intent(Config.ACTION_PRINT),”com.qf.permission.print”);先判断应用有没有对应的权限 再去判断有没有对应的act ...