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. [RxJS] Introduction to RxJS Marble Testing

    Marble testing is an expressive way to test observables by utilizing marble diagrams. This lesson wi ...

  2. Zend Studio / Ecliplse插件StartExplorer

    Install site.zip (quick and simple way) Locate zip file under site\target in Project Explorer, Start ...

  3. 使用mii-tool设置网卡速率

    转载:http://washion2008.blog.163.com/blog/static/144227201001711537158/ 在ubuntu中,mii-tool 是属于net-tools ...

  4. Linux下使用mke2fsk格式化虚拟磁盘分区的方法

    原文地址:http://www.2cto.com/os/201202/119963.html 我们用dd命令就可以创建一个raw格式的虚拟磁盘,通常Xen就是使用这种格式的虚拟磁盘,今天就来讨论下怎样 ...

  5. Java设计模式12:常用设计模式之外观模式(结构型模式)

    1. Java之外观模式(Facade Pattern) (1)概述:       现代的软件系统都是比较复杂的,设计师处理复杂系统的一个常见方法便是将其"分而治之",把一个系统划 ...

  6. envi5.1下载地址

    ENVI 5.1 installer 32 bit :链接: http://pan.baidu.com/s/1c0EGZIw 密码: gcogENVI 5.1 Installer 64 bit :链接 ...

  7. 利用传感器(sensor)实现微信摇一摇动画

    所需要的权限: <uses-permission android:name="android.permission.VIBRATE"></uses-permiss ...

  8. 在vs环境中跑动sift特征提取(代码部分)

    因为在前两天的学习中发现.在opencv环境中跑动sift特征点提取还是比较困难的. 所以在此,进行记述. 遇到的问题分别有,csdn不愿意花费积分.配置gtk困难.教程海量然而能跑者鲜.描述不详尽等 ...

  9. oracle 逗号分割,列转行,行转列

    SQL代码 列转行 select REGEXP_SUBSTR(a.rolecode ,,l) rolecode from ( select 'a,aa,aaa' rolecode from dual ...

  10. iaas,paas,saas理解

    IaaS.PaaS.SaaS多次看到这几个单词,今天仔细看看来, ​这几个词和云计算相关:1,iaaS,Hardware-as-a-Service,信息,硬件服务,服务器,存储和网络硬件,网络存储,带 ...