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 ...
随机推荐
- SQLserver中用convert函数转换日期格式(1)
SQLserver中用convert函数转换日期格式2008-01-15 15:51SQLserver中用convert函数转换日期格式 SQL Server中文版的默认的日期字段datetime格式 ...
- ROS-Solidworks转URDF
前言:URDF建模很粗糙,而ros提供了支持sw转urdf的插件,可以使建模更精细化. 一.安装sw_urdf_exporter插件 sw_urdf_exporter插件网址:http://wiki. ...
- BZOJ 1989 概率相关
思路: 一条边免费的概率为 (经过它的路/总路径条数)^2 DFS即可 有个地方没有用 long long炸了好久- //By SiriusRen #include <cstdio> us ...
- centos 部署 .net core runtime 环境
除非在linux下开发才安装SDK,一般生产环境只需安装 runtime 1.添加 yum 源 sudo rpm --import https://packages.microsoft.com/key ...
- T7316 yyy的最大公约数(者)
题目背景 全场基本暴力 题目描述 输入输出格式 输入格式: 如图 输出格式: 如图 输入输出样例 输入样例#1: 如图 输出样例#1: 如图 说明 如图 这题用到了容斥原理和线性筛的一些东西, 表示没 ...
- windows phone LongListSelector加载下一页
LongListSelector利用ListHeader.ListFooter加载上一页和下一页XAML代码: <phone:LongListSelector> <phone:Lon ...
- Android 让系统自动生成缩略图并写入媒体库
MediaStore.Video.Thumbnails.getThumbnail(ContentResolver cr, long origId, int kind, BitmapFactory.Op ...
- 配置 Windows Phone 8.1通过Fiddler代理上网
第一部分,共享笔记本无线网络 前提条件: 1)笔记本一台(双网卡(有线+无线网卡) 2)网络适配器中有2张网卡: 有线连接,名称Ethernet(必须已插上有线网络,且可以上网) 无线连接,名称Wi- ...
- Vue-给对象新增属性(使用Vue.$set())
在开发过程中,我们时常会遇到这样一种情况:当vue的data里边声明或者已经赋值过的对象或者数组(数组里边的值是对象)时,向对象中添加新的属性,如果更新此属性的值,是不会更新视图的. 根据官方文档定义 ...
- UVA401-Palindromes(紫书例题3.3)
A regular palindrome is a string of numbers or letters that is the same forward as backward. For exa ...