codeforces 987B. 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.

题意:给出x,y 问 x yyxxy>yx 的关系
分析:暴力的思路两边取log变成求ylogx和xlogy的关系,因为题目给出的是整数所以实际上没有想象中那么卡精度,等于那里再加个判断(x==y)
另外还有思路就是用证明的方法
xy > yx


可知越靠近e就越优秀,然后胡乱搞一波就行了

这里有个坑就是如果x=2,y=4时是等于


取log暴力判断的

#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<algorithm>
#include<queue>
#include<set>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<cmath>
#include<stack>
#include<iomanip>
#include<functional>
#include <iomanip>
#include<bitset>
using namespace std;
typedef long long LL;
typedef unsigned long long ull;
const int maxn = (int)1e5 + 100;
const int BN = 30;
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1000000007;
const double eps = 1e-8;
const double PI = acos(-1);
int main() {
	double a, b;
	scanf("%lf%lf", &a, &b);
	double t1 = b*log(a), t2 = a*log(b);
	if (fabs(a - b) < eps || fabs(t1 - t2) < eps) printf("=\n");
	else if (t1 > t2) printf(">\n");
	else printf("<\n");
	return 0;
}

证明xjb搞的

#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<algorithm>
#include<queue>
#include<set>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<cmath>
#include<stack>
#include<iomanip>
#include<functional>
#include <iomanip>
#include<bitset>
using namespace std;
typedef long long LL;
typedef unsigned long long ull;
const int maxn = (int)1e5 + 100;
const int BN = 30;
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1000000007;
const double eps = 1e-10;
const double PI = acos(-1);
int main() {
	LL a, b;
	while (~scanf("%I64d%I64d", &a, &b)) {
		if (a == b) printf("=\n");
		else if (a == 1) printf("<\n");
		else if (b == 1) printf(">\n");
		else if (a == 2) {
			if (b == 3) printf("<\n");
			else if (b == 4) printf("=\n");
			else printf(">\n");
		}
		else if (b == 2) {
			if (a == 3) printf(">\n");
			else if (a == 4) printf("=\n");
			else printf("<\n");
		}
		else {
			if (a > b) printf("<\n");
			else printf(">\n");
		}
	}
	return 0;
}


x
yyx
x yyx
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值