Codeforces 987B. High School: Become Human
解题思路:
1.题意:判断x^y和y^x谁大谁小。
2.由于x^y和y^x太大了,时间复杂度也不允许,所以做同等变换,比较e^(ylnx)和e^(xlny)。
3.即为比较ylnx和xlny的大小。
注意:
由于涉及到浮点数,我们需要处理一下误差,若差值在1e-6范围内视为相等。
代码:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; int main(){
ios::sync_with_stdio(false);
double x,y;
cin >> x >> y;
double a = 1.0*x*log(y);
double b = 1.0*y*log(x);
// cout << fabs(a-b) << endl;
if(fabs(a-b) < 1e-){
cout << "=" << endl;
}else if(b > a){
cout << ">" << endl;
}else if(b < a){
cout << "<" << endl;
}
return ;
}
Codeforces 987B. High School: Become Human的更多相关文章
- Codeforces Round #354 (Div. 2) E. The Last Fight Between Human and AI 数学
E. The Last Fight Between Human and AI 题目连接: http://codeforces.com/contest/676/problem/E Description ...
- Codeforces 676E The Last Fight Between Human and AI 规律
链接 Codeforces 676E The Last Fight Between Human and AI 题意 给一个多项式,有些系数不确定.人和机器轮流填系数,系数可以是任何数,问是否能使得最后 ...
- Codeforces Round #485 (Div. 2)-B-High School: Become Human
B. High School: Become Human time limit per test 1 second memory limit per test 256 megabytes input ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
- Codeforces 528D Fuzzy Search(FFT)
题目 Source http://codeforces.com/problemset/problem/528/D Description Leonid works for a small and pr ...
- CodeForces 527B Error Correct System
Error Correct System Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I6 ...
- Codeforces Gym 100637G G. #TheDress 暴力
G. #TheDress Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100637/problem/G ...
- codeforces 148E Aragorn's Story 背包DP
Aragorn's Story Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/probl ...
- Codeforces Gym 100269B Ballot Analyzing Device 模拟题
Ballot Analyzing Device 题目连接: http://codeforces.com/gym/100269/attachments Description Election comm ...
随机推荐
- 基于nginx的最基础的TCP代理,经过测试可通!
测试操作系统为win7,nginx版本为1.9.4. 在本机上编写java程序一个socket服务类SocketServer,监听端口为8889, (增加了一个SocketServerThread线程 ...
- web.config or app.config 中configSections配置节点
以前还真没见过,今天看项目中有在用,简单写了个Demo,这样配置的好处就是可以自定义配置,更加模块化,直接上代码; 1.配置文件 由于我创建的是一个控制台项目,所以配置文件是App.Config:(这 ...
- LInux学习之常用命令ls
命令格式与目录处理命令ls 命令格式: 命令[-选项][参数] 例如: ls -la /etc 说明: 1)个别命令使用不遵循此格式 2)当多个选项时,可以写在一起 3)简化选项与完整选项 -a ...
- Git+VS2015修改提交代码以及解决冲突
第一步:前提我们已经讲代码从git上clone(可以看我的GIt篇)下来,创建自己的开发分支.我们在自己本地的分支上开发. 看到右下角有一个develop那是我自己建立的开发的分支,现在点击devel ...
- 值得尝试的十款 GNOME Shell 扩展
值得尝试的十款 GNOME Shell 扩展 作者: JACK WALLEN 译者: 核子可乐 | 2016-09-22 17:10 评论: 6 收藏: 1 当 GNOME Shell(即 GNO ...
- Jmeter--Timer设置等待时间
一.Jmeter定时器的概念:1)定时器是在每个sampler(采样器)之前执行的,而不是之后:是的,你没有看错,不管这个定时器的位置放在sampler之后,还是之下,它都在sampler之前得到执行 ...
- Eclipse项目启动不了
当你的Eclipse项目启动不了多半是[eclipse工程jdk版本]的问题 在eclipse中项目jdk版本不匹配的时候需要修改项目工程的jdk版本,但是网上的一些版本修改不是很完全,经过一些摸索之 ...
- C语言实现将一个整形数转换为两个字节16进制
有时候要用到这个转换,这里记录一下,例如把 int a = 164 转换储存在数组里为 uint8_t b[0]=0x00 , b[1]=0xA4 . 很简单,转换如下: b[0] = a > ...
- typedef和define混用产生的错误
最近在写代码过程中,发现一个问题,编译总是过不去,报错如下: stdint.h::: error: duplicate 'unsigned' stdint.h::: error: 'long long ...
- SpringCloud 构建微服务架构-练习
我使用的springboot的版本为2.0.2.RELEASE,这里概念性的东西我就不粘贴复制了,百度一下 都是 一.启动Eureka注册中心服务 1.新建springboot项目,pom.xml配置 ...