按照公式推导即可。
#include <cstdio>
#include <cmath>
#include <map>
int main(int argc, char const *argv[]) {
char ch1, ch2;
double f1, f2;
double tem, dew, hum;
while ((ch1 = getchar())) {
if (ch1 == 'E') {
break;
}
scanf("%lf%*c%c%lf%*c", &f1, &ch2, &f2);
std::map<int, double> mp;
// tem = dew = hum = 0;
mp[ch1] = f1;
mp[ch2] = f2;
tem = mp['T'];
dew = mp['D'];
hum = mp['H'];
if (tem == 0) {
double e = 6.11 * pow(2.718281828, 5417.7530 * ((1.0 / 273.16) - (1.0 / (dew + 273.16))));
double h = 0.5555 * (e - 10.0);
tem = hum - h;
} else if (hum == 0) {
double e = 6.11 * pow(2.718281828, 5417.7530 * ((1.0 / 273.16) - (1.0 / (dew + 273.16))));
double h = 0.5555 * (e - 10.0);
hum = tem + h;
} else {
double h = hum - tem;
double e = h / 0.5555 + 10.0;
dew = 1.0 / ((1.0 / 273.16 - log(e / 6.11) / 5417.7530)) - 273.16;
}
printf("T %.1f D %.1f H %.1f\n", tem, dew, hum);
}
return 0;
}