/*
Time:2019.11.30
Author: Goven
type:简单数学
err:
ref:
*/
#include<iostream>
#include<cmath>
using namespace std;
double getHumidex(double t, double d) {
return t + 0.5555 * (6.11 * exp(5417.7530 * ((1/273.16) - (1/(d+273.16))))-10);
}
double getTemperature(double h, double d) {
return h - 0.5555 * (6.11 * exp(5417.7530 * ((1/273.16) - (1/(d+273.16))))-10);
}
double getDewpoint(double t, double h) {
return 1 / (1/273.16 - log(((h - t) / 0.5555 + 10) / 6.11) / 5417.7530) - 273.16;
}
int main()
{
double a, b, t;
char c, d;
while (cin >> c) {
if (c == 'E') break;
cin >> a >> d >> b;
if (c == 'T' && d == 'D') {
t = getHumidex(a, b);
printf("T %.1lf D %.1lf H %.1lf\n", a, b, t);
}
else if (c == 'T' && d == 'H') {
t = getDewpoint(a, b);
printf("T %.1lf D %.1lf H %.1lf\n", a, t, b);
}
else if (c == 'D' && d == 'T') {
t = getHumidex(b, a);
printf("T %.1lf D %.1lf H %.1lf\n", b, a, t);
}
else if (c == 'D' && d == 'H') {
t = getTemperature(b, a);
printf("T %.1lf D %.1lf H %.1lf\n", t, a, b);
}
else if (c == 'H' && d == 'T') {
t = getDewpoint(b, a);
printf("T %.1lf D %.1lf H %.1lf\n", b, t, a);
}
else if (c == 'H' && d == 'D') {
t = getTemperature(a, b);
printf("T %.1lf D %.1lf H %.1lf\n", t, b, a);
}
}
return 0;
}
网友评论