poj 3299 Humidex

//题目很简单:给出两个数,求第三个数! 
//ln函数在c++中的函数原型是log(),exp()函数是以e为底,x为幂的函数!谨记! 
#include "iostream"
#include "string"
#include "cmath"
#include "stdio.h"
using namespace std;

int main()
{
    string str1, str2;
    double num1, num2, ans;
    while (cin >> str1)
    {
          if (str1 == "E") break;
          cin >> num1 >> str2 >> num2;
          if (str1 == "T" && str2 == "D")
          {
              ans = num1 + (0.5555) * (6.11 * exp(5417.7530 * ((1/273.16) - (1/(num2 + 273.16)))) - 10.0);
              printf("T %.1lf D %.1lf H %.1lf\n", num1, num2, ans);
          }
          else if (str1 == "T" && str2 == "H")
          {
               double h = num2 - num1;
               ans = 1/(1/273.16 - log((h/0.5555+10)/6.11)/5417.7530) - 273.16;
               printf("T %.1lf D %.1lf H %.1lf\n", num1, ans, num2);
          }
          else if (str1 == "D" && str2 == "H")
          {
               double h =0.5555 * ((6.11 * exp(5417.7530*((1/273.16)-(1/(num1+273.16))))) - 10.0);
               ans = num2 - h;
               printf("T %.1lf D %.1lf H %.1lf\n", ans, num1, num2);
          }
          else if (str1 == "D" && str2 == "T")
          {
               ans = num2 + (0.5555) * (6.11 * exp(5417.7530 * ((1/273.16) - (1/(num1 + 273.16)))) - 10.0);
               printf("T %.1lf D %.1lf H %.1lf\n", num2, num1, ans);
          }
          else if (str1 == "H" && str2 == "D")
          {
               double h =0.5555 * ((6.11 * exp(5417.7530*((1/273.16)-(1/(num2+273.16))))) - 10.0);
               ans = num1 - h;
               printf("T %.1lf D %.1lf H %.1lf\n", ans, num2, num1);
          }
          else if (str1 == "H" && str2 == "T")
          {
               double h = num1 - num2;
               ans = 1/(1/273.16 - log((h/0.5555+10)/6.11)/5417.7530) - 273.16;
               printf("T %.1lf D %.1lf H %.1lf\n", num2, ans, num1);
          }
    }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值