Codeforces Round #485 (Div. 2)-B-High School: Become Human
1 second
256 megabytes
standard input
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.
On the only line of input there are two integers xx and yy (1≤x,y≤1091≤x,y≤109).
If xy<yxxy<yx, then print '<' (without quotes). If xy>yxxy>yx, then print '>' (without quotes). If xy=yxxy=yx, then print '=' (without quotes).
5 8
>
10 3
<
6 6
=
In the first example 58=5⋅5⋅5⋅5⋅5⋅5⋅5⋅5=39062558=5⋅5⋅5⋅5⋅5⋅5⋅5⋅5=390625, and 85=8⋅8⋅8⋅8⋅8=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(">\n");
}else if(a<b){
printf("<\n");
}
else printf("=\n");
}
return ;
}
Codeforces Round #485 (Div. 2)-B-High School: Become Human的更多相关文章
- Codeforces Round #485 (Div. 2)
Codeforces Round #485 (Div. 2) https://codeforces.com/contest/987 A #include<bits/stdc++.h> us ...
- Codeforces Round #485 (Div. 2) D. Fair
Codeforces Round #485 (Div. 2) D. Fair 题目连接: http://codeforces.com/contest/987/problem/D Description ...
- Codeforces Round #485 (Div. 2) F. AND Graph
Codeforces Round #485 (Div. 2) F. AND Graph 题目连接: http://codeforces.com/contest/987/problem/F Descri ...
- Codeforces Round #485 (Div. 2) E. Petr and Permutations
Codeforces Round #485 (Div. 2) E. Petr and Permutations 题目连接: http://codeforces.com/contest/987/prob ...
- Codeforces Round #485 (Div. 2) C. Three displays
Codeforces Round #485 (Div. 2) C. Three displays 题目连接: http://codeforces.com/contest/987/problem/C D ...
- Codeforces Round #485 (Div. 2) A. Infinity Gauntlet
Codeforces Round #485 (Div. 2) A. Infinity Gauntlet 题目连接: http://codeforces.com/contest/987/problem/ ...
- Codeforces Round #485 (Div. 2) C题求三元组(思维)
C. Three displays time limit per test 1 second memory limit per test 256 megabytes input standard in ...
- Codeforces Round #485 Div. 1 vp记
A:对每种商品多源bfs一下每个点到该商品的最近距离,对每个点sort一下取前s个即可. #include<iostream> #include<cstdio> #includ ...
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
随机推荐
- ntohs, ntohl, htons,htonl对比
ntohs =net to host short int 16位htons=host to net short int 16位ntohl =net to host long int 32位htonl= ...
- C++实现第三方资源释放与载入过程(以DLL为例)
简介 我们经常看见有一些程序开始执行时会释放一些文件,以便于后续操作.例如一些病毒为了便于传播和隐藏,经常把一些需要用的动态库或是驱动文件打包进一个可执行文件中,再由需要使用的时候,再临时释放和加载. ...
- Javascript_06_表单验证(离开单项,输入框后提示信息)
Javascript_06_ 表单验证(离开单项,输入框后提示信息) 说明:对于必须输入的入力框,光标离开(使用 onblur方法)时进行检查.假如有错,红色的提示信息直接在该画面的这个输入框的后面显 ...
- centos7如何安装gcc5.4
由于需要使用到cilk plus和std=c++14,所以决定将编译器升级. 基本教程如下: 1.下载GCC源码: wget ftp://mirrors.kernel.org/gnu/gcc/gcc- ...
- February 17th, 2018 Week 7th Saturday
The happiest part of a man's life is what he passes lying awake in bed in the morning. 人生一大乐事莫过去早上醒来 ...
- February 11th, 2018 Week 7th Sunday
Grasp all, lose all. 欲尽得,必尽失. Not to be greedy and not to try to get everything. Our time, energy an ...
- C语言 投票系统:给定候选人,从键盘输入候选人的名字,统计票数,并输出最终获胜者
投票系统:给定候选人名单,从键盘输入候选人的名字,统计票数,并输出最终获胜者.若投票人输入的名字不在其候选名单上,则该票数无效. //凯鲁嘎吉 - 博客园 http://www.cnblogs.com ...
- 028实现strStr()
#pragma once #include "000库函数.h" /*********************自解**************/ //使用算法中的find 12ms ...
- Spring的AOP开发的相关术语
转载自 https://www.cnblogs.com/ltfxy/p/9873618.html SpringAOP简介: AOP思想最早是由AOP联盟组织提出的.Spring使用这种思想最好的框架. ...
- 【消息队列】RabbitMQ+PHP实现
本文链接:http://www.cnblogs.com/aiweixiao/p/7374249.html 文档提纲: 扫描关注微信公众号 1.[下载和安装] 1)gitHub下载地址: https:/ ...