ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

CF987B - High School: Become Human

2019-04-27 20:54:29  阅读:283  来源: 互联网

标签:Vasya School cout ln androids High Output Input Become


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

Input

On the only line of input there are two integers x and y (1≤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 5 8=5⋅5⋅5⋅5⋅5⋅5⋅5⋅5=390625, and 85=8⋅8⋅8⋅8⋅8=32768. So you should print '>'.

In the second example 10 3=1000<3 10=59049.

In the third example 6 6=46656=6 6.

这道题,看题意首先想到快速幂,再看数据范围,显然会炸,那么最简单粗暴的方法就是,比较 x ^ y 与 y ^ x 的大小关系。(如此简洁明了的题面 >_<)

我们要先在两式旁取对数,就是比较 ln x ^ y 与 ln y ^ x 的大小关系,先假设左式小于右式:(前方高能,请注意)

ln x ^ y < ln y & x; 即 y * ln x < x * lny;

所以 ln x / x < ln y / y;

那么通过归纳我们可以设 f (n) = ln n / n;

取这个函数的导数,即 f'(n) = ( ln n - 1 )/ n ^ 2;

那么当 f'(n)> 0 时, ln n > 1, 所以当 x, y > e (因为是整数,相当于大于等于3)时, 若 x > y, 则 x ^ y < y ^ x;

证明完成之后,我们就可以知道,当给出的 x , y 大于 3 的时候,只需要判断 x 和 y 的大小关系即可,其他的只要特判就可以了

 

 

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x,y,i;
	cin>>x>>y;
	if(x == y){
		cout<<"="<<endl;
		return 0;
	}
	else{
		if(x == 1){
			cout<<"<";
			return 0;
		}
		if(y == 1){
			cout<<">";
			return 0;
		}
		int h = max(x,y);
		if(h <= 4){
			long long sum1 = 1,sum2 = 1;
			for(i = 1; i <= y; i++){
				sum1 *= x;
			}
			for(i = 1; i <= x; i++){
				sum2 *= y;
			}
			if(sum1 < sum2){
				cout<<"<";
			}
			else if(sum1 > sum2){
				cout<<">";
			}
			else{
				cout<<"=";
			}
		}
		else{
			if(x > y){
				cout<<"<";
			}
			else{
				cout<<">";
			}
		}
	}
	return 0;
}

  

 

标签:Vasya,School,cout,ln,androids,High,Output,Input,Become
来源: https://www.cnblogs.com/clb123/p/10780228.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有