//题目很简单:给出两个数,求第三个数!
//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);
}
}
}
poj 3299 Humidex
最新推荐文章于 2024-11-14 19:11:37 发布