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 0

Sample 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的更多相关文章

  1. POJ 2707

    #include<iostream> #include<stdio.h> #include<algorithm> using namespace std; int ...

  2. String reduction (poj 3401

    String reduction Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 1360   Accepted: 447 D ...

  3. poj 1046 ——Color Me Less

    提交地址:http://poj.org/problem?id=1046 Color Me Less Time Limit: 1000MS   Memory Limit: 10000K Total Su ...

  4. poj和hdu部分基础算法分类及难度排序

    最近想从头开始刷点基础些的题,正好有个网站有关于各大oj的题目分类(http://www.pythontip.com/acm/problemCategory),所以写了点脚本把hdu和poj的一些题目 ...

  5. 论文翻译:2020_Joint NN-Supported Multichannel Reduction of Acoustic Echo, Reverberation and Noise

    论文地址:https://ieeexploreieee.fenshishang.com/abstract/document/9142362 神经网络支持的回声.混响和噪声联合多通道降噪 摘要 我们考虑 ...

  6. POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理

    Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798 ...

  7. POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理

    Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   ...

  8. POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治

    The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286 ...

  9. POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法

    Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 37427   Accepted: 16288 Descr ...

随机推荐

  1. Android版本号的识别——$(PLATFORM_VERSION)

    #/******************************************************************************#*@file Android.mk#* ...

  2. [Angular-Scaled Web] 9. Control your promises with $q

    Learn how to manually control how asynchronous requests are handled with the use of promises. Becaus ...

  3. <label>标签for属性的妙用

    在用户注册的时候,常常用户点击文字就需要将光标聚焦到对应的表单上面,这个是怎么实现的呢?就是下面我要介绍的<label>标签的for属性 定义:for 属性规定 label 与哪个表单元素 ...

  4. DataBase 之 实用积累

    (1)分页:(性能效果最好的是top/max 和Row_number()两种方法) [1]写法1,not in/top select top pagesize * from pagetest wher ...

  5. SQLServer 之 char、varchar、nvarchar的区别

    一.定义 1.char char是定长的,也就是当你输入的字符小于你指定的数目时,它会再后面补空值.当你输入的字符大于指定的数时,它会截取超出的字符. 例如:char(8),最多可输入4个汉字或者8个 ...

  6. Android进阶笔记07:Android之MVC 理解

     1. 为什么需要MVC ? 软件中最核心的,最基本的东西是什么?  答:是的,是数据.我们写的所有代码,都是围绕数据的.      围绕着数据的产生.修改等变化,出现了业务逻辑.      围绕着数 ...

  7. 渐进式jpeg(progressive jpeg)图片及其相关 --图片的两种加载方式

    渐进式jpeg(progressive jpeg)图片及其相关   一.基本JPEG(baseline jpeg)和渐进JPEG 网络上那些色色的照片都是.jpg格式的("色色"指 ...

  8. SQL Server2008附加数据库失败

    今天旁晚时分,我准备把老师在上课时候发给我们的一个数据库附加到我的SQL Server2008上面去,本来在学校机房用的SQL Server2000是很顺利地就成功了,但是把*.mdf文件附加到我的0 ...

  9. 给jdk写注释系列之jdk1.6容器(1)-ArrayList源码解析

    工作中经常听到别人讲“容器”,各种各样的容器,话说到底什么是容器,通俗的讲“容器就是用来装东西的器皿,比如:水桶就是用来盛水的,水桶就是一个容器.” ok,在我们写程序的时候常常要对大量的对象进行管理 ...

  10. javaweb学习总结二十(http响应)

    一:http响应 1:http响应的组成部分 状态行.响应头.空行.响应数据 2:状态行 常用状态码: 200:请求成功 302:请求路径已经转移,请访问别的地址 307或者304: 请访问缓存信息 ...