Codeforces987B——High School: Become Human
判斷x^y
和 y^x
的大小關係
很簡單的題,取個log就行,比較坑的地方是取完log是一個浮點數,會出現精度誤差,這樣判斷大小還行,判斷相等就出問題了,雖然在本地a-b<0.0000001能過,提交上去就不行了,所以直接在輸入兩個數的時候判斷就行了
程式碼:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll x,y;
int main(void){
scanf("%lld%lld",&x,&y);
if(x==y){
printf( "=\n");
return 0;
}
double a=y*log(x);
double b=x*log(y);
if(a<b){
printf("<\n");
}
else if(a>b){
printf(">\n");
}
else{
printf("=\n");
}
return 0;
}
相關推薦
Codeforces987B——High School: Become Human
判斷x^y 和 y^x的大小關係 很簡單的題,取個log就行,比較坑的地方是取完log是一個浮點數,會出現精度誤差,這樣判斷大小還行,判斷相等就出問題了,雖然在本地a-b<0.0000001能過,提交上去就不行了,所以直接在輸入兩個數的時候判斷就行了 程式碼: #inclu
【思維】Codeforces Round #485 (Div. 2) B. High School: Become Human(對數)
space scanf CA ace ima AC bsp ont http 題目鏈接:http://codeforces.com/contest/987/problem/B 在運算的時候取對數就好了 1 #include <bits/stdc++
題目:B. High School: Become Human
contest double 大小 想法 its pan HR www. CI 題目:B. High School: Become Human 題目鏈接:http://codeforces.com/contest/987/problem/B Key words:math
High School: Become Human(數學思維)
seconds () sample code span amp eas number cat Year 2118. Androids are in mass production for decades now, and they do all the work for
CF987B High School: Become Human 數學
pro quotes input digi cti set class a NPU str 題意翻譯 題目大意 輸入一個 xxx ,一個 yyy ,求是 xyx^yxy 大還是 yxy^xyx 大。 (1≤x,y≤109)(1≤x,y≤10^9)(1≤x,y≤109)
【題解】codeforces987BHigh School: Become Human 數學知識
取對數乘出來比較(同學的一道考試題……這題1分鐘就沒了吧) #include<cstdio> #include<iostream> #include<cmath> using namespace std; const double eps=1e-6;
Codeforces 1090A - Company Merging - [簽到水題][2018-2019 Russia Open High School Programming Contest Problem A]
題目連結:https://codeforces.com/contest/1090/problem/A A conglomerate consists of n companies. To make managing easier, their owners have decided to merge all
Codeforces 1090D - Similar Arrays - [思維題][構造題][2018-2019 Russia Open High School Programming Contest Problem D]
題目連結:https://codeforces.com/contest/1090/problem/D Vasya had an array of n integers, each element of the array was from 1 to n. He chose m pairs of differ
UVA10071 Back to High School Physics:題解
題目連結:https://www.luogu.org/problemnew/show/UVA10071 題意簡敘: 粒子從0速度提速到t時速度為v,求出2*t時所運動的距離 分析: 這道題是一道物理題 ,首先我們知道粒子最初的速度是0,又已知其在t時間時速度為v,由
Codeforces 1090M - The Pleasant Walk - [簽到水題][2018-2019 Russia Open High School Programming Contest Problem M]
題目連結:https://codeforces.com/contest/1090/problem/M There are n houses along the road where Anya lives, each one is painted in one of k possible colors. A
Codeforces 1090B - LaTeX Expert - [字串模擬][2018-2019 Russia Open High School Programming Contest Problem B]
題目連結:https://codeforces.com/contest/1090/problem/B Examplesstandard input The most famous characters of Pushkin’s works are Onegin \cite{onegin}
2018 BACS High School Programing Contest J.Non Super Boring Substring-manacher+雙指標
題意: 給出一個字串,求其子串中不包含長度大於等於k的迴文串的子串個數 思路: 對於單串迴文問題,考慮使用manacher演算法進行預處理,即可處理出以每個位置為中點的最長迴文半徑 使用雙指標技術,結合迴文半徑的資訊,處理出以每個位置為起點,在不構成大於等於
Report Card: Customizing Our Women in Tech High School Trainee Program
Mentor Quentin (left) with Trainee Bresy (right) Bresy joined the program after completing her freshman year at Eastside College Prep, and entered the pr
kubeadm init 卡在 Created API client, waiting for the control plane to become ready
mon issues https res 出現 blog ted col journal 執行 kubeadm init 時出現卡在了 [apiclient] Created API client, waiting for the control plane to beco
Cisco UBR10012使用DRL保護cpu,防止high cpu問題
high cpu ubr10012 drl Cisco UBR10012在日常維護的過程中出現high cpu問題,經檢查是DHCPD Receive進程占用過高。說明設備受到了過量的DHCP報文,為避免影響正常業務流量,配置DRL(Divert Rate Limit)對UBR10012的
CodeForces 785D Anton and School - 2
tdi continue article map ces java code detail ans 枚舉,容斥原理,範德蒙恒等式。 先預處理每個位置之前有多少個左括號,記為$L[i]$。 每個位置之後有多少個右括號,記為$R[i]$。 然後枚舉子序列中第一個右括號的位
視頻筆記 CppCon 2016 Chandler Carruth High Performance Code 201 Hybrid Data Structures
簡單 work int small 包含 接口 cat multi 類型擦除 版權聲明:轉載請說明出處 http://www.cnblogs.com/eagledai/ https://www.youtube.com/watch?v=vElZc6zSIXM&t=11
Human Gene Functions POJ 1080 最長公共子序列變形
cee diff print bmi ces -s compare %d determine Description It is well known that a human gene can be considered as a sequence, consisting
Human Motion Analysis with Wearable Inertial Sensors——閱讀3
http ble margin images 有效 優化算法 nbsp man 過濾器 Human Motion Analysis with Wearable Inertial Sensors——閱讀3 四元數方向濾波器 之前的研究開發了一種自適應增益互補濾波器
codeforces 785D D. Anton and School - 2
style ems its com -1 return 他能 har pow 題目鏈接:http://codeforces.com/problemset/problem/785/D 題意:給你一個只包含‘(‘和‘)‘的字符串,然後問他的子序列中有多少滿足前一半是左括號,後一