Poj 2707 Copier Reduction
来源:互联网 发布:淘宝steam激活码哪来的 编辑:程序博客网 时间:2024/06/12 13:58
1.Link:
http://poj.org/problem?id=2707
2.Content:
Copier ReductionTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 8315 Accepted: 4389Description
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 28010 25 88 108 13 5 19 13 10 6199 333 40 275 90 218 280999 99 1 100 0 0 0Sample Output
50%100%12%66%1%100%1%Source
Mid-Central USA 2005
3.Method:
4.Code:
1 #include<iostream> 2 using namespace std; 3 int main() 4 { 5 int a,b,c,d; 6 int temp; 7 int e,f; 8 while((cin>>a>>b>>c>>d)&&!(a==0&&b==0&&c==0&&d==0)) 9 {10 if(a<b)11 {12 temp=a;13 a=b;14 b=temp;15 }16 if(c<d)17 {18 temp=c;19 c=d;20 d=temp;21 }22 e=c*100/a;23 f=d*100/b;24 if(e<f)25 {26 if(e>100) e=100;27 cout<<e<<"%"<<endl;28 }29 else30 {31 if(f>100) f=100;32 cout<<f<<"%"<<endl;33 }34 }35 //system("pause");36 return 0;37 }
0 0
- POJ 2707 Copier Reduction
- poj 2707 Copier Reduction
- Poj 2707 Copier Reduction
- POJ 2707 Copier Reduction G++
- POJ 2707 Copier Reduction 解题报告
- POJ 2707 Copier Reduction 水 模拟
- Copier Reduction pku 2707
- poj2707 Copier Reduction
- 1887. Copier Reduction
- TOJ 1887.Copier Reduction
- POJ 1907 Work Reduction
- reduction
- 测试reduction
- List Reduction
- uva10670Work Reduction
- String Reduction
- antique reduction
- parallel reduction
- LinkedList和ArrayList的区别 (转)
- Java序列化的机制和原理(转)
- 分享下今天研究的流量上限DDos攻击分析和解决方案
- Poj OpenJudge 1068 Parencodings
- Poj 2583 Series Determination
- Poj 2707 Copier Reduction
- Bitmap OOM问题解决及优化
- Poj 2840 Big Clock
- Poj 3030 Nasty Hacks
- Poj 3062 Celebrity jeopardy
- Poj 3117 World Cup
- Poj 3278 Catch That Cow
- Poj 3126 Prime Path
- xcode的快捷键