High School: Become Human(数学思维)

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. 

题目意思:给你两个数x, y, 比较 x^y 和 y ^ x 的大小

解题思路:首先看看这个x^y的表达式是不是很熟悉,是不是就是高数里面的幂指函数,那么想一想我们在幂指函数求导等操作中是怎么做的,没错就是取对数!!利用ln将幂指函数抬起!!

例如:xy  = e ln (x^y) =  e y(ln x)   。(也可以使用lg,以10为底的对数,把下面代码里面的log10()改为log()即可

这里我在对log ()函数进行一下说明。

double log (double); 以e为底的对数
double log10 (double);c++中自然对数函数:log(N)   以10为底:log10(N)但没有以2为底的函数但是可以用换底公式解 决:log2(N)=log10(N)/log10(2)

 

 1 #include<cstdio>
 2 #include<cmath>
 3 const int eps=1e-9;
 4 int main()
 5 {
 6     int x,y;
 7     double a,b;
 8     scanf("%d%d",&x,&y);
 9     a=log10(x)*y;
10     b=log10(y)*x;
11     if(fabs(a-b)<=eps)
12     {
13         printf("=\n");
14     }
15     else if(a-b<0)
16     {
17         printf("<\n");
18     }
19     else
20     {
21         printf(">\n");
22     }
23     return 0;
24 }

 

posted @ 2018-08-31 12:53  王陸  阅读(447)  评论(0编辑  收藏  举报