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.
InputOn the only line of input there are two integers?x
?and? y?( 1≤x,y≤109).
OutputIf?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= NoteIn 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)比較
大佬的AC代碼
錯誤
若x=2,y=4,則2^4=4^2
總結
以上是生活随笔為你收集整理的codeforces B. High School: Become Human的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Codeforces D. Fair 多
- 下一篇: 第十届四川省大学生程序设计竞赛