[HdOJ]5170 GTY's math problem

来源:互联网 发布:淘宝泳衣女装连体 编辑:程序博客网 时间:2024/05/29 14:32

幂比较大小

取对数比较就好了log(ab)=b∗log(a),注意会有精度误差

#include <stdio.h>#include <math.h>int main(void){    double a,b,c,d;    while(scanf("%lf %lf %lf %lf",&a,&b,&c,&d)!=EOF)        {            if(b*log(a)-d*log(c)>1e-10)                {                    printf(">\n");                }            else if(d*log(c)-b*log(a)>1e-10)                {                    printf("<\n");                }            else                 {                    printf("=\n");                }        }    return 0;}
0 0