zoukankan      html  css  js  c++  java
  • Codeforces Round #485 (Div. 2)-B-High School: Become Human

    B. High School: Become Human
    time limit per test
    1 second
    memory limit per test
    256 megabytes
    input
    standard input
    output
    standard output

    Year 2118. Androids are in mass production for decades now, and they do all the work for humans. But androids have to go to school to be able to solve creative tasks. Just like humans before.

    It turns out that high school struggles are not gone. If someone is not like others, he is bullied. Vasya-8800 is an economy-class android which is produced by a little-known company. His design is not perfect, his characteristics also could be better. So he is bullied by other androids.

    One of the popular pranks on Vasya is to force him to compare xyxy with yxyx. Other androids can do it in milliseconds while Vasya's memory is too small to store such big numbers.

    Please help Vasya! Write a fast program to compare xyxy with yxyx for Vasya, maybe then other androids will respect him.

    Input

    On the only line of input there are two integers xx and yy (1x,y1091≤x,y≤109).

    Output

    If xy<yxxy<yx, then print '<' (without quotes). If xy>yxxy>yx, then print '>' (without quotes). If xy=yxxy=yx, then print '=' (without quotes).

    Examples
    input
    Copy
    5 8
    output
    Copy
    >
    input
    Copy
    10 3
    output
    Copy
    <
    input
    Copy
    6 6
    output
    Copy
    =
    Note

    In the first example 58=55555555=39062558=5⋅5⋅5⋅5⋅5⋅5⋅5⋅5=390625, and 85=88888=3276885=8⋅8⋅8⋅8⋅8=32768. So you should print '>'.

    In the second example 103=1000<310=59049103=1000<310=59049.

    In the third example 66=46656=6666=46656=66.

     不知道为什么。。。取对数就莫名wa。。。比较x*logy和y*logx就是错的。。。而比较x/y和logx/logy就是对的。。。。

    没考虑到一个问题就是x^y=y^x有可能x!=y....所以应该先判读大于和小于最后否则就是等于,这样就避免了考虑精度问题由于本题是1e9,因此x/y-logx/logy=exp()<=1e-12

    一般精度是要高于范围三位

     #include<iostream>
    #include<string.h>
    #include<stdio.h>
    #include<math.h>
    using namespace std;
    int main(){
        int x,y;
        while (~scanf("%d%d",&x,&y)){
             double a=log(x)/log(y);
             double b=x*1.0/y;
             if(a>b){
                 printf(">
    ");
             }else if(a<b){
                 printf("<
    ");
             }
             else printf("=
    ");
        }
        return 0;
    }
    有不懂欢迎咨询 QQ:1326487164(添加时记得备注)
  • 相关阅读:
    IP负载均衡技术
    ES6 克隆对象 浅克隆:只能克隆原始对象自身的值,不能克隆它继承的值
    多层nginx中的压缩问题 api接口>1M数据的返回浏览器 网关
    Status Code: 431 Request Header Fields Too Large
    研发过程中的测试工作
    dede文章页调用当前栏目链接方法
    dedecms做好的网站怎么上传到网上?
    如何修改"DEDECMS 提示信息!"方法!
    dedecms搜索提示"关键字不能小于2个字节!"
    修改cms版权等等信息
  • 原文地址:https://www.cnblogs.com/bluefly-hrbust/p/9114003.html
Copyright © 2011-2022 走看看