zoukankan      html  css  js  c++  java
  • A

    Problem description

    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 xy with yx. 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 xywith  yx for Vasya, maybe then other androids will respect him.

    Input

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

    Output

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

    Examples

    Input

    5 8

    Output

    >

    Input

    10 3

    Output

    <

    Input

    6 6

    Output

    =

    Note

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

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

    In the third example 66=46656=66.

    解题思路:由于题目给的数据较大,因此要将指数运算转换成对数运算。注意:通常采用作差法来比较两个小数的大小,如果两数之差的绝对值小于或等于一个非常小的精度值eps(如1e-8或着1e-9),一般默认它们是相等的。

    AC代码:

     1 #include<bits/stdc++.h>
     2 using namespace std;
     3 int main(){
     4     double x,y,m,n;
     5     cin>>x>>y;
     6     m=y*log10(x);
     7     n=x*log10(y);
     8     if(abs(m-n)<=1e-8)cout<<'='<<endl;//必须特判一下两个小数是否相等
     9     else if(m>n)cout<<'>'<<endl;
    10     else cout<<'<'<<endl;
    11     return 0;
    12 }
  • 相关阅读:
    <%!%>和<%%>的区别
    <jsp:param>传参乱码问题
    RedHat6.4 安装yum源
    J2EE中getParameter与getAttribute以及对应的EL表达式
    Ubuntu xrdp 遠端桌面連線 a
    Ubuntu SSH server 快速安裝和設定 a
    Ubuntu 12.04 快速安裝 Scrapy a
    Linux 壓縮與解壓縮指令備忘錄 a
    vim 設定快捷鍵為 [Ctrl] + [s] 存檔 a
    Linux 常用指令備忘錄 a
  • 原文地址:https://www.cnblogs.com/acgoto/p/9116872.html
Copyright © 2011-2022 走看看