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 ...
随机推荐
- exosip
exosip针对UA是对osip进行扩展,oSIP不提供不论什么高速产生请求消息和响应消息的方法,全部请求消息和响应消息的形成必须调用一组sip message api来手动组装完毕,所以作者在osi ...
- 设置Delphi XE4默认界面样式
VCL BitMap Style Proceject Options->Application->Appearance 选择几个样式 使用代码设置 uses Vcl.Themes; ...
- 升级、备份红帽PaaS openshift 上的 wordpress
红帽提供了一个很稳定的PAAS服务平台:openshift!此博客即作为wordpress建在里面. 这里记录怎样升级与备份wordpress. 预备: 安装 openshift command li ...
- C#二维数组(矩形数组,交错数组)
C# 支持一维数组.多维数组(矩形数组)和数组的数组(交错的数组) 1.多维数组 声明:string[,] names; 初始化:int[,] numbers = new int[3, 2] { {1 ...
- session销毁
session.invalidate(),session.invalidate的销毁是把这个session所带的用户彻底的销毁,这个session跟用户已经紧密联合在一起,所以就一起销毁了,这样就算换 ...
- Linux内核初始化定义
转载:http://blog.csdn.net/beatbean/article/details/8448623 1. Compile宏控制 位于include/linux/init.h /* The ...
- Windows Service 之 详解(一)
一.Windows 服务简介 Windows 服务是可以在系统启动时自动打开的(不需要任何人登录计算机)的程序. 1.适合创建Windows 服务的场景: [1] 在没有用户交互操作的情况下运行程序: ...
- Storm中并发程度的理解
Storm中涉及到了很多组件,例如nimbus,supervisor等等,在参考了这两篇文章之后,对这个有了更好的理解. Understanding the parallelism of a Stor ...
- Android客户端token简介和简单应用
一.什么是Token Token是服务端生成的一串字符串,以作客户端进行请求的一个令牌,当第一次登录后,服务器生成一个Token便将此Token返回给客户端,以后客户端只需带上这个Token前来请求数 ...
- Oracle常用命令13(数据库的启动、关闭)
数据库的启动.关闭 数据库的启动:安装启动.非安装启动.共享启动.独占启动.约束启动.强制启动 --不登陆的方式进入 Sqlplus /nolog 安装启动: Startup {pfile=<f ...