题目链接

题意:输入x,a,y,b求x/a和y/b的大小,范围long long int

思路:因为不想用精度,嫌麻烦,所以用了个巧方法。先求x/a和y/b整形的大小,如果相等,再求(x%a)*b和(y%b)*a的大小,具体为什么可以这样比较,初中生都会。

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#include<string>
#define ll long long
using namespace std;
int main()
{
ll x,y,a,b;
while(scanf("%lld%lld%lld%lld",&x,&a,&y,&b)!=EOF)
{
ll z1=x/a;
ll z2=y/b;
if(z1>z2)
{
printf(">\n");
}
else if(z1<z2)
{
printf("<\n");
}
else
{
ll y1=x%a;
ll y2=y%b;
ll r1=y1*b;
ll r2=y2*a;
if(r1==r2)
printf("=\n");
if(r1>r2)
printf(">\n");
if(r1<r2)
printf("<\n");
}
}
}

Fraction Comparision的更多相关文章

  1. ZJUT11 多校赛补题记录

    牛客第一场 (通过)Integration (https://ac.nowcoder.com/acm/contest/881/B) (未补)Euclidean Distance (https://ac ...

  2. 2019牛客暑期多校第一场题解ABCEFHJ

    A.Equivalent Prefixes 传送门 题意:给你两个数组,求从第一个元素开始到第p个元素 满足任意区间值最小的元素下标相同的 p的最大值. 题解:我们可以从左往右记录到i为止每个区间的最 ...

  3. 2019牛客多校 Round1

    Solved:4 Rank:143 A Equivalent Prefixes 题意:求一个最大的r满足在A,B两个数组中1,r里所有的子区间RMQ相等 题解:单调队列秒 #include <b ...

  4. [LeetCode] Fraction to Recurring Decimal 分数转循环小数

    Given two integers representing the numerator and denominator of a fraction, return the fraction in ...

  5. Fraction to Recurring Decimal

    Given two integers representing the numerator and denominator of a fraction, return the fraction in ...

  6. 【leetcode】Fraction to Recurring Decimal

    Fraction to Recurring Decimal Given two integers representing the numerator and denominator of a fra ...

  7. Decimal To Fraction 小数转换成分数

    以0.25为例, 0.25 * 100 = 25, 求25 和 100 的最大公约数gcd. 25/gcd 为分子. 100/gcd为分母. //小数转分数 //0.3 -> 3/10, 0.2 ...

  8. ✡ leetcode 166. Fraction to Recurring Decimal 分数转换 --------- java

    Given two integers representing the numerator and denominator of a fraction, return the fraction in ...

  9. Leetcode 166. Fraction to Recurring Decimal 弗洛伊德判环

    分数转小数,要求输出循环小数 如2 3 输出0.(6) 弗洛伊德判环的原理是在一个圈里,如果一个人的速度是另一个人的两倍,那个人就能追上另一个人.代码中one就是速度1的人,而two就是速度为2的人. ...

随机推荐

  1. Gitlab仓库搭建和免密使用gitlab

    Gitlab简介 GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务. 可通过Web界面进行访问公开的或者私人项目.它拥有与Github类似的 ...

  2. Github建站笔记

    下载Git 搜索"Git",在官网中根据系统版本下载,并双击打开,按默认已勾选组件点下一步; 勾选在Windows命令行窗口中使用Git: 使用推荐的OpenSSL库用于HTTPS ...

  3. github转gitee

    1.20190717,在SHH发现 下载github上的代码很慢(大概有422M),网上搜了 往文件“C:\Windows\System32\drivers\etc\hosts”中添加 ip& ...

  4. JS验证数字

    //1.验证数字 var reg = new RegExp("^[0-9]*$"); //var reg = /^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+ ...

  5. 微信小程序这一块(上)

    1.根目录下面的文件: 凡是以app开头的都是全局配置文件 app.js 全局逻辑文件 注册小程序 app.json 全局配置文件 https://developers.weixin.qq.com/m ...

  6. Django CORS跨域资源共享

    1,什么是CORS ​ 允许浏览器向跨源(协议 + 域名 + 端口)服务器发出XMLHttpRequest请求,从而克服了AJAX只能同源使用的限制 2,特点 ​ 1,浏览器自动完成(在请求头中加入特 ...

  7. jmeter处理接口加密和解密

    https://www.liangzl.com/get-article-detail-39672.html https://www.cnblogs.com/artoftest/p/7277996.ht ...

  8. [Python3] 022 面向对象 第二弹

    目录 6. 面向对象的三大特性 6.1 封装 6.1.1 私有 private 6.1.2 受保护 protected 6.1.3 公开 public 6.2 继承 6.2.1 继承的概念与作用 6. ...

  9. go 文件读写

    go 文件读写有很多方式 ioutil读文件 package main import ( "io/ioutil" "fmt" ) func main() { d ...

  10. java、javaw和javaws的区别

    java.javaw和javaws的区别: 首先,所有的这些都是java的启动装置,java.exe经常使用,当使用命令行输出到window的时候,会有java.exe进程,通过任务管理器可以看到.通 ...