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 ...
随机推荐
- C# 3.0的新特性
自动属性. 之前定义属性的步骤: private filed + public property. 现在的形式:int id{get;set;}. 可以分别设置get/set的保护级别(protect ...
- UWP tips (与wp8.1的不同)
一.异步调用之后,要更新UI时,代码如下 await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =&g ...
- IE8不支持响应式设计解决方法
下载并引入 respond.js 即可 为了针对IE8应用这段脚本,需要针对IE8的条件注释 <!--[if lt IE 9]> --- <! [endif]--> 为了不让并 ...
- php 生成不重复的随机字符串
md5(uniqid(md5(microtime(true)),true))
- 「JavaSE 重新出发」05.01 继承
继承 一个对象变量可以指示多种实际类型的现象被称为多态(polymorphism). 在运行时能够自动地选择调用哪个方法的现象称为动态绑定(dynamic binding). 如果是private方法 ...
- thinkphp 5 count()方法在控制器,模板中的使用方法
thinkphp中关于count()方法的使用: 控制器中:echo count($arr)模板中:{$arr | count}模板中if判断语句中 <if condition="co ...
- 三、frpc 完整配置文件
# [common] is integral section [common] # A literal address or host name for IPv6 must be enclosed # ...
- python3 列表操作
- 创建列表 #创建列表: list1 = [1, 2, 3, 4, 5] - 向列表中添加元素 - append # 向列表中添加元素: list1 = [1, 2, 3, 4, 5] list1. ...
- (56) 解决字段设为readonly无法保存
问题描述:当一个字段设为readonly =True 后,在form表单,即使你用onchange方法改变了值但也不能保存到数据库当时.平时在这样的要求,form表单有些字段要展示给用户,但又要达到不 ...
- Numpy的使用规则
之前安装的python版本是3.7 各种库都是自己一个一个下载安装的 很操心 各种缺功能 后来发现了anaconda 啊 真是一个好东西 简单来说 它就是一个涵盖大部分常用库的python包 一次安装 ...