/*给出你图片的长和宽的比例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. 在create-react-app的脚手架里面使用scss

    之前用vue-cli脚手架的时候,只需要引进sass需要的依赖包便可以引入scss,但是在create-react-app的时候,发现除了需要引入sass依赖,还需要进行配置: 不管用什么方法进行sa ...

  2. jquery获取父级元素、子级元素、兄弟元素的方法

    jQuery.parent(expr) 找父亲节点,可以传入expr进行过滤,比如$("span").parent()或者$("span").parent(&q ...

  3. 调试寄存器 原理与使用:DR0-DR7

    调试寄存器 原理与使用:DR0-DR7 下面介绍的知识性信息来自intel IA-32手册(可以在intel的开发手册或者官方网站查到),提示和补充来自学习调试器实现时的总结. 希望能给你带去有用的信 ...

  4. 网络电话pjsip Getting Started: Building for Apple iPhone, iPad and iPod Touch

    Getting Started: Building for Apple iPhone, iPad and iPod Touch ¶ Getting Started Preparation Get th ...

  5. C++面向对象类的实例题目十二

    题目描述: 写一个程序计算正方体.球体和圆柱体的表面积和体积 程序代码: #include<iostream> #define PAI 3.1415 using namespace std ...

  6. api静态化预案

    1.之前听到api静态化预案,一直以为是前端发送api请求,如果api请求失败,则再次发送一条请求,去请求备份的静态资源. 2.前两天了解到的api静态化预案是这样的:在请求api时,给api请求加上 ...

  7. JavaWeb温习之HttpServletResponse对象

    以下内容均根据"方立勋JavaWeb视频教程"进行总结 1. HttpServletResponse常见应用——设置响应头控制浏览器的行为 1.1 设置http响应头控制浏览器禁止 ...

  8. 微信小程序 --- 获取网络状态

    获取网络状态:wx.getNetworkType btnclick:function(){ wx.getNetworkType({ success:function(res){ console.log ...

  9. oracle数据库实例状态

    1.已启动/不装载(NOMOUNT).启动实例,但不装载数据库. 该模式用于重新创建控制文件,对控制文件进行恢复或重新创建数据库.2.已装载(MOUNT).装载数据库,但不打开数据库. 该模式用于更改 ...

  10. vue自定义过滤器的创建和使用

    1.简单介绍   过滤器的作用:实现数据的筛选.过滤.格式化.   过滤器的本质是一个有参数,有返回值的方法.   过滤器可以用在两个地方:双花括号插值和v-bind表达式(后者从2.1.0+开始支持 ...