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 ...
随机推荐
- solaris知识库
http://xjsunjie.blog.51cto.com/999372/d-9/p-1
- day02 Java基础
1.Java中的关键字都是小写的. 2.Java中的关键字 3.Java中的注释分为:单行注释.多行注释.文档注释 文档注释将被javadoc工具解析生成一个说明书. 4.Java中的常量分为字面值常 ...
- UNIX标准化及实现之UNIX标准化、UNIX系统实现、标准和实现的关系以及ISO C标准头文件
一.UNIX标准化 1.ISO C (International Organization for Standardization) 2.IEEE POSIX (Institue of Electri ...
- php执行的困惑
最近在用php语言实现各种数据结构算法排序,可以说是很蛋疼的一件事,最近遇到了一个问题,不知道是什么原因,姑且放到这里,希望能看到的人予以帮助 首先我用php写了这样一个类 class ListNod ...
- Helpers\ReservedWords
Helpers\ReservedWords This helper returns an array of reserved words, this includes php 7's new rese ...
- js与asp.net后台交互
1.如何在JavaScript访问C#函数? 2.如何在JavaScript访问C#变量? 3.如何在C#中访问JavaScript的已有变量? 4.如何在C#中访问JavaScript函数? 问题1 ...
- 第三方框架FMDB
摘要:关键点:创建.插入.查询.数据格式化 第三方框架FMDB -------------------------------------------------------------------- ...
- 【安卓面试题】使用SQLiteOpenHelper的getReadableDatabase()获得的数据库能不能,做写的操作
可以! 不要被Readable的意思误导啦,readable是可读的意思,但不代表不能写哦. getReadableDatabase() 会获取用于操作SQLiteDatabase的实例. getRe ...
- 为什么我要称自己为Javascript程序员
Aaron Griffin写了一篇精彩的牢骚文章,主要是关于各种框架和它们能把程序员从主要业务编程中抽离出来的功能特征.概括一下他的主要论点,当你成为了一个“Rails程序员”,你使用的是一种易于理解 ...
- Linux下安装配置Node及memcached
这篇主要是记录Linux下安装Node及memcached遇到的问题及安装配置过程,方便日后查阅 Node安装及配置 [root@hostname ~]tar zxvf node-v0.12.4.ta ...