模拟。
注意输入为很多种情况,TD,TH,DH
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
using namespace std;
char s1[100],s2[100];
double t,d,h;
double a1,a2;
double E=2.718281828;
int vis[300];
void fun(char c,double x)
{
if(c=='T')
{
vis[c]=1;
t=x;
}
else if(c=='D')
{
vis[c]=1;
d=x;
}
else
{
vis[c]=1;
h=x;
}
}
int main()
{
while(scanf("%s",s1)!=EOF)
{
memset(vis,0,sizeof vis);
if(s1[0]=='E')
break;
scanf("%lf",&a1);
scanf("%s%lf",s2,&a2);
fun(s1[0],a1);
fun(s2[0],a2);
if(!vis['H'])
{
double e=6.11*exp(5417.7530 * ((1.0/273.16) - (1.0/(d+273.16))));
h= (0.5555)* (e - 10.0)+t;
}
if(!vis['T'])
{
double e=6.11*pow(E,(5417.7530 * ((1.0/273.16) - (1.0/(d+273.16)))));
t=h-(0.5555)* (e - 10.0);
}
if(!vis['D'])
{
double e=(h-t)/(0.5555)+ 10.0;
d=1/((1/273.16)-log(e/6.11)/5417.7530 )-273.16;
}
printf("T %.1f D %.1f H %.1f\n",t,d,h);
}
return 0;
}