码迷,mamicode.com
首页 > 其他好文 > 详细

codeforces 987B

时间:2018-07-15 21:11:52      阅读:133      评论:0      收藏:0      [点我收藏+]

标签:mat   font   iostream   force   display   put   end   div   pac   

给你两个数x, y, 比较 x^y 和 y ^ x 的大小

Input

两个数 x, y, ( 1 <= x , y <= 109 )

Output

如果 x ^ y < y ^ x , 输出 “<”

如果 x ^ y > y ^ x , 输出 “>”

如果 x ^ y = y ^ x , 输出 “=”

Sample Input

Input
5 8
Output
>
Input
10 3
Output
<
Input
6 6
Output
=
x^y 和 y^x 比大小 不好比
可以转成求 y*logx 和 x*logy 的大小


#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    int x,y;
    cin>>x>>y;
    if(y*log(x)<x*log(y))
        cout<<"<"<<endl;
    else if(y*log(x)==x*log(y))
        cout<<"="<<endl;
    else
        cout<<">"<<endl;
    return 0;
}

 

codeforces 987B

标签:mat   font   iostream   force   display   put   end   div   pac   

原文地址:https://www.cnblogs.com/coder-tcm/p/9314655.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!