/*给出你图片的长和宽的比例a:b 和摄像头的比例c:d,然后叫你求最后将图片放进摄像头
以后,剩余的面积比上摄像头的总面积,注意要化简为最简形式,而且摄像头要设置成至少一条边和图片相等
做法;先将两个比例式子通分,分别比较分母和分子,通分以后必定有一条边是相等的,所以只要比较另一条边就可以了
*/
#include <iostream>
#include<string.h>
#include<stdio.h>
#include<math.h>
using namespace std;
int gcd(int x,int y)
{
int t=;
while(t!=)
{t=x%y;x=y;y=t;}
return x;
}
void f(int a,int b)
{
int g;
g=gcd(a,b);
while(g>)
{
a/=g;
b/=g;
g=gcd(a,b);
}
if(a<b)
printf("%d/%d\n",a,b);
else
printf("%d/%d\n",b,a);
}
int int_abs(int a) {return a>?a:-a;}
int main()
{
int x,y,X,Y,g,a,b,A,B;
while(scanf("%d%d%d%d",&x,&y,&X,&Y)!=EOF)
{
a=x*Y;
b=y*Y;
A=X*y;
B=Y*y;
if(a>A)
f(abs(a-A),a>A?a:A);
else
{
a=x*X;
b=y*X;
A=X*x;
B=Y*x;
f(abs(b-B),b>B?b:B);
}
}
return ;
}

337BRoutine Problem的更多相关文章

  1. 1199 Problem B: 大小关系

    求有限集传递闭包的 Floyd Warshall 算法(矩阵实现) 其实就三重循环.zzuoj 1199 题 链接 http://acm.zzu.edu.cn:8000/problem.php?id= ...

  2. No-args constructor for class X does not exist. Register an InstanceCreator with Gson for this type to fix this problem.

    Gson解析JSON字符串时出现了下面的错误: No-args constructor for class X does not exist. Register an InstanceCreator ...

  3. C - NP-Hard Problem(二分图判定-染色法)

    C - NP-Hard Problem Crawling in process... Crawling failed Time Limit:2000MS     Memory Limit:262144 ...

  4. Time Consume Problem

    I joined the NodeJS online Course three weeks ago, but now I'm late about 2 weeks. I pay the codesch ...

  5. Programming Contest Problem Types

        Programming Contest Problem Types Hal Burch conducted an analysis over spring break of 1999 and ...

  6. hdu1032 Train Problem II (卡特兰数)

    题意: 给你一个数n,表示有n辆火车,编号从1到n,入站,问你有多少种出站的可能.    (题于文末) 知识点: ps:百度百科的卡特兰数讲的不错,注意看其参考的博客. 卡特兰数(Catalan):前 ...

  7. BZOJ2301: [HAOI2011]Problem b[莫比乌斯反演 容斥原理]【学习笔记】

    2301: [HAOI2011]Problem b Time Limit: 50 Sec  Memory Limit: 256 MBSubmit: 4032  Solved: 1817[Submit] ...

  8. [LeetCode] Water and Jug Problem 水罐问题

    You are given two jugs with capacities x and y litres. There is an infinite amount of water supply a ...

  9. [LeetCode] The Skyline Problem 天际线问题

    A city's skyline is the outer contour of the silhouette formed by all the buildings in that city whe ...

随机推荐

  1. iOS 9 分屏多任务:入门(中文版)

    本文转载至 http://www.cocoachina.com/ios/20150714/12555.html 本文由钢铁侠般的卿哥(微博)翻译自苹果官方文档:Adopting Multitaskin ...

  2. 《C++ Primer Plus》第7章 函数——C++的编程模块 学习笔记

    函数是C++的编程模块.要使用函数,必须提供定义和原型,并调用该函数.函数定义是实现函数功能的代码:函数原型描述了函数的接口:传递给函数的值的书目和种类以及函数的返回类型.函数调用使得程序将参数传递给 ...

  3. 【PHP】使用openssl进行Rsa长数据加密(117)解密(128)

    PHP使用openssl进行Rsa加密,如果要加密的明文太长则会出错,解决方法:加密的时候117个字符加密一次,然后把所有的密文拼接成一个密文:解密的时候需要128个字符解密一下,然后拼接成数据. 加 ...

  4. java基础---->FilenameFilter之文件过滤

    FilenameFilter用于对列表中文件名的过滤,今天我们就开始java中FilenameFilter的学习.好多年了,你一直在我的伤口中幽居,我放下过天地,却从未放下过你,我生命中的千山万水,任 ...

  5. vux 局部注册组件

    在home.vue里面,引入Prop.vue组件: 其中 <child :message="msg"></child>的时候 是这么赋值的: data () ...

  6. 报错 ERROR in static/js/vendor.b3f56e9e0cd56988d890.js from UglifyJs

    开发vux项目在引入 // 表单验证组件-start import zh_CN from 'vee-validate/dist/locale/zh_CN' import Validator from ...

  7. centos7 elk install :ELK 安装 6.1.2版本

    参考:http://blog.csdn.net/h952520296/article/details/78873849 (参考) 官网下载:https://www.elastic.co/cn/down ...

  8. 阅读笔记:A Few useful things to Know About machine Learning

    这是Machine Learning领域的经典论文,文中提到了ML相关的12个keys,并自称这些keys是“black art”,我觉得有点像ML的“最佳实践”. 网上有此文的中文翻译,写得很详细, ...

  9. Tomcat 500错误 问题集锦

    HTTP 500 - 内部服务器错误  1.jdk版本与Tomcat版本不一样. 问题: 配置一个Web应用的时候,源文件和server.xml.web.xml的配置都没有问题,但是在访问到一个Ser ...

  10. 关于cdn原理(就是内容分发网络)

    cdn,我理解其本质就是为了解决距离远产生的速度问题,使用就近的服务. 从中国请求美国一台服务器上的图片.一般比较慢,因为距离这么远,网络传输是存在损耗的,距离越远,传输的时间就越长.一般会看到浏览器 ...