zoukankan      html  css  js  c++  java
  • POJ 3299 Humidex 难度:0

    题目链接:http://poj.org/problem?id=3299

    #include <iostream>
    #include <iomanip>
    using namespace std;
    double exp(double x){
        double ans=1;
        double td=1;
        for(int i=1;i<120;i++){
            td=td*x/i;
            ans+=td;
        }
        return ans;
    }
     const double ine= 2.718281828 ;
    double ln(double x){
        double ans=0;
       while(x<-1||x>1){
        ans++;
        x=(x+1)/ine-1;
       }
        double td=-1;
        for(int i=1;i<120;i++){
            td*=-x;
            ans+=td/(double)i;
        }
        return ans;
    }
    double t,d,h,temp;
    int flag;
    int main(){
        ios::sync_with_stdio(false);
        char st[9];
        while(cin>>st){
            flag=0;
            if(st[0]=='E'){
                break;
            }
            cin>>temp;
            if(st[0]=='T'){
                    flag+=1;
                    t=temp;
            }
            else if(st[0]=='D'){
                    flag+=2;
                    d=temp;
            }
            else if(st[0]=='H'){
                    flag+=3;
                    h=temp;
            }
            cin>>st;
            cin>>temp;
            if(st[0]=='T'){
                    flag+=1;
                    t=temp;
            }
            else if(st[0]=='D'){
                    flag+=2;
                    d=temp;
            }
            else if(st[0]=='H'){
                    flag+=3;
                    h=temp;
            }
            if(flag==3) h=t-5.555+0.555*6.11*exp(5417.7530* ((1/273.16) - (1/(d+273.16))));
            else if(flag==4) {
                    double e=((h-t)/0.5555)+10.0;
    
                    double td=ln((e/6.11)-1);
                    d=1.0/((1.0/273.16)-td/5417.7530)-273.16;
            }
            else t= h+ 5.555- 0.555*6.11*exp(5417.7530* ((1/273.16) - (1/(d+273.16))));
            cout<<"T "<<setiosflags(ios::fixed)<<setprecision(1)<<t<<" D "<<d<<" H "<<h<<"
    ";
        }
        return 0;
    }
    
  • 相关阅读:
    如何在Ubuntu上安装配置和使用Docker
    在Ubuntu 20.04 LTS Focal Fossa上安装Netdata Monitoring
    CG-CTF 480小时精通C++
    IDA 动态调试
    CG-CTF 签到
    CG-CTF WxyVM
    buu 达芬奇 && ROT
    buu firmware
    buu [MRCTF2020]keyboard
    buu signin
  • 原文地址:https://www.cnblogs.com/xuesu/p/4639761.html
Copyright © 2011-2022 走看看