Poj 2707 Copier Reduction
1.Link:
http://poj.org/problem?id=2707
2.Content:
Copier Reduction
Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8315 Accepted: 4389 Description
What do you do if you need to copy a 560x400mm image onto a standard sheet of US letter-size paper (which is about 216x280mm), while keeping the image as large as possible? You can rotate the image 90 degrees (so that it is in "landscape" mode), then reduce it to 50% of its original size so that it is 200x280mm. Then it will fit on the paper without overlapping any edges. Your job is to solve this problem in general.Input
The input consists of one or more test cases, each of which is a single line containing four positive integers A, B, C, and D, separated by a space, representing an AxBmm image and a CxDmm piece of paper. All inputs will be less than one thousand. Following the test cases is a line containing four zeros that signals the end of the input.Output
For each test case, if the image fits on the sheet of paper without changing its size (but rotating it if necessary), then the output is 100%. If the image must be reduced in order to fit, the output is the largest integer percentage of its original size that will fit (rotating it if necessary). Output the percentage exactly as shown in the examples below. You can assume that no image will need to be reduced to less than 1% of its original size, so the answer will always be an integer percentage between 1% and 100%, inclusive.Sample Input
560 400 218 280
10 25 88 10
8 13 5 1
9 13 10 6
199 333 40 2
75 90 218 280
999 99 1 10
0 0 0 0Sample Output
50%
100%
12%
66%
1%
100%
1%Source
3.Method:
4.Code:
#include<iostream>
using namespace std;
int main()
{
int a,b,c,d;
int temp;
int e,f;
while((cin>>a>>b>>c>>d)&&!(a==&&b==&&c==&&d==))
{
if(a<b)
{
temp=a;
a=b;
b=temp;
}
if(c<d)
{
temp=c;
c=d;
d=temp;
}
e=c*/a;
f=d*/b;
if(e<f)
{
if(e>) e=;
cout<<e<<"%"<<endl;
}
else
{
if(f>) f=;
cout<<f<<"%"<<endl;
}
}
//system("pause");
return ;
}
Poj 2707 Copier Reduction的更多相关文章
- POJ 2707
#include<iostream> #include<stdio.h> #include<algorithm> using namespace std; int ...
- String reduction (poj 3401
String reduction Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1360 Accepted: 447 D ...
- poj 1046 ——Color Me Less
提交地址:http://poj.org/problem?id=1046 Color Me Less Time Limit: 1000MS Memory Limit: 10000K Total Su ...
- poj和hdu部分基础算法分类及难度排序
最近想从头开始刷点基础些的题,正好有个网站有关于各大oj的题目分类(http://www.pythontip.com/acm/problemCategory),所以写了点脚本把hdu和poj的一些题目 ...
- 论文翻译:2020_Joint NN-Supported Multichannel Reduction of Acoustic Echo, Reverberation and Noise
论文地址:https://ieeexploreieee.fenshishang.com/abstract/document/9142362 神经网络支持的回声.混响和噪声联合多通道降噪 摘要 我们考虑 ...
- POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理
Halloween treats Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 7644 Accepted: 2798 ...
- POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理
Find a multiple Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7192 Accepted: 3138 ...
- POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治
The Pilots Brothers' refrigerator Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 22286 ...
- POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法
Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 37427 Accepted: 16288 Descr ...
随机推荐
- 将PHP作为Shell脚本语言使用
我们都知道.PHP是一种非常好的动态网页开发语言(速度飞快.开发周期短--).可是仅仅有非常少数的人意识到PHP也能够非常好的作为编写Shell脚本的语言,当PHP作为编写Shell脚本的语言时,他并 ...
- 日志分析(二) logstash patterns
grok-patterns内置了很多基础变量的正则表达式的log解析规则,其中包括apache的log解析(同样可以用于nginx的log解析). 基于nginx日志分析配置: 1.配置nginx ...
- cvsnt 设置用户、修改密码
忘记密码后,可以用administrator 新建一个用户,使用这个用户的账号. password agent 设置clear password不好使.. cvsnt配置 创建用户1 .下载cvs ...
- C#_Jquery无刷新上传
昨晚网友有下载了一个jQuery无刷新上传的小功能,他尝试搬至ASP.NET MVC应用程序中去,在上传死活无效果.Insus.NET使用Teamviewer远程桌面,操作一下,果真是有问题.网友是说 ...
- 谷歌chrome浏览器桌面提醒 webkitNotifications
原创: //点击时开启提醒 $(".message_alert").toggle(function(){ $(".message_alert_tip").htm ...
- Maven 修改本地存储库位置--转
step1:默认会放在~/.m2/repository目录下 (“~”代表用户的目录,比如windows下一般都是C:\Documents and Settings\[你的用户名]\), step2: ...
- 使用coreData
1.设计数据模型 2.创建持久化视图和控制器 #import "BIDViewController.h" #import "BIDAppDelegate.h" ...
- Hibernate的简单示例
首先我们新建一个项目,Java项目或者是Javaweb项目都可以,然后把hibernate需要的jar导入,我用的jar包如下: 然后新建一个实体类Teacher.java并添加get和set方法: ...
- Android(java)学习笔记109:通过反射获取成员变量和成员方法并且使用
一.反射获取成员变量并且使用: 1.获取字节码文件对象: Class c = Class.forName("cn.itcast_01.Person"); 2.使用无 ...
- 笔记——Function类型 及其 call、apply方法
每个函数都是Function类型的实例.函数有三种定义方式和两个内部属性arguments和this. 同时函数也是对象,也有属性和方法.本篇主要其call()和apply()方法 属性 length ...