日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

codeforces B. High School: Become Human

發(fā)布時間:2024/10/6 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 codeforces B. High School: Become Human 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
點擊打開鏈接
B. High School: Become Humantime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard 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?xy

?with? yx

. 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?xy

?with? yx

?for Vasya, maybe then other androids will respect him.

Input

On the only line of input there are two integers?x

?and? y?( 1x,y109

).

Output

If?xy<yx

, then print ' <' (without quotes). If? xy>yx, then print ' >' (without quotes). If? xy=yx

, then print '=' (without quotes).

ExamplesinputCopy5 8 outputCopy> inputCopy10 3 outputCopy< inputCopy6 6 outputCopy= Note

In the first example?58=5?5?5?5?5?5?5?5=390625

, and? 85=8?8?8?8?8=32768

. So you should print '>'.

In the second example?103=1000<310=59049

.

In the third example?66=46656=66

.

題意:

輸入兩個數,x,y,如果x^y>y^x就輸出>,小于就輸出<,等于就輸出=。

思路:

由數據范圍,肯定不能乘算,所以可以變換一下? ?兩邊取對數 log(x^y) 與 log(y^x)比較

即:y*log(x) 與 x*log(y)比較


#include <bits/stdc++.h> using namespace std; #define eps 1e-6 int main() {int x,y;double xx;scanf("%d %d",&x,&y);xx = y*log10(x) - x*log10(y);if(fabs(xx) <= eps)printf("=\n");else{if(xx < eps)printf("<\n");elseprintf(">\n");}return 0; }

大佬的AC代碼

#include<bits/stdc++.h> using namespace std; int main() {int x,y;cin>>x>>y;if(log(x)*y>(log(y)*x))puts(">");else if(log(y)*x>(log(x)*y)) puts("<");else puts("="); }

錯誤

若x=2,y=4,則2^4=4^2

#include <bits/stdc++.h> using namespace std; #define eps 1e-6 int main() {int x,y;double xx;scanf("%d %d",&x,&y);if(x==y)printf("=\n");else{xx = y*log10(x) - x*log10(y);if(xx < eps)printf("<\n");elseprintf(">\n");}return 0; }

總結

以上是生活随笔為你收集整理的codeforces B. High School: Become Human的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。