zoukankan      html  css  js  c++  java
  • Codeforces Round #485 (Div. 2) B. High School: Become Human

    Codeforces Round #485 (Div. 2) B. High School: Become Human

    题目连接:

    http://codeforces.com/contest/987/problem/B

    Description

    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 $x^y$ with $y^x$. 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 $x^y$ with $y^x$ for Vasya, maybe then other androids will respect him.

    Sample Input

    5 8
    

    Sample Output

    >
    

    题意

    比较 (x^y)(y^x) 的大小

    Comparing the size of (x^y) and (y^x) .

    题解:

    如果有 (a=b),则有(log(a)=log(b)),利用log的运算,将乘法变成加法。

    if we have (a=b),we will get (log(a)=log(b)).Changing the calculating method.

    代码

    #include <bits/stdc++.h>
    
    using namespace std;
    
    using ll = long long;
    ll q,w;
    
    
    int main() {
        cin>>q>>w;
        if (log10(q)*w-log10(w)*q>1e-8)
            return 0*puts(">");
        else if (-log10(q)*w+log10(w)*q>1e-8)
            return 0*puts("<");
        else return 0*puts("=");
    }
    
    
  • 相关阅读:
    移动端rem屏幕设置
    封装ajax库,post请求
    获取浏览器url参数
    身份证验证
    jq封装插件
    页面分享功能,分享好友、朋友圈判断,用share_type做标记 这里用的是jweixin-1.3.2.js
    @RequestParam和@RequestBody区别
    400报错
    IDEA中用Maven构建SSM项目环境入门
    Eclipse搭建Spring开发环境
  • 原文地址:https://www.cnblogs.com/EDGsheryl/p/9156782.html
Copyright © 2011-2022 走看看