poj3299

#include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;

double HH(double TT,double DD)
{
    double h,e;
    e=6.11*exp(5417.7530*((1/273.16)-(1/(DD+273.16))));
    h=0.5555*(e-10.0);
    return TT+h;
}

double DD(double TT,double HH)
{
    double h,e,p;
    h=HH-TT;
    e=h/0.5555+10.0;
    p=log(e/6.11);
    p=p/5417.7530;
    p=(1/273.16)-p;
    return 1/p-273.16;


}

double TT(double DD,double HH)
{
    double h,e;
    e=6.11*exp(5417.7530*((1/273.16)-(1/(DD+273.16))));
    h=0.5555*(e-10.0);
    return HH-h;

}
 
int main()
{   double T,D,H;
    char type1,type2;
    cin>>type1;
    while (type1!='E')
    {
        if (type1=='T') cin>>T;
        if (type1=='D') cin>>D;
        if (type1=='H') cin>>H;
        cin>>type2;
        if (type2=='T') cin>>T;
        if (type2=='D') cin>>D;
        if (type2=='H') cin>>H;
        if ((type1!='H')&&(type2!='H')) H=HH(T,D);
        if ((type1!='D')&&(type2!='D')) D=DD(T,H);
        if ((type1!='T')&&(type2!='T')) T=TT(D,H);
        cout<<"T ";
        printf("%.1lf",T);
        cout<<" D ";
        printf("%.1lf",D);
        cout<<" H ";
        printf("%.1lf\n",H);
        cin>>type1;
    }
    return 0;
}
就是有H(humidex),D(dewpoint),T(humidex)三个值;输入其中的两个值,然后通过humidex = temperature + hh = (0.5555)× (e - 10.0)e = 6.11 × exp [5417.7530 × ((1/273.16) - (1/(dewpoint+273.16)))]三个公式解出剩下的一个值,然后把三个都输出来。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值