#include <iostream>
#include<cstdio>
#include<cmath>
using namespace std;
const char *s="TDH";
double tem,dew,ham;
void TD()
{
double e=6.11*exp(5417.7530*((1.0/273.16)-(1.0/(dew+273.16))));
double h=0.5555*(e-10.0);
ham=tem+h;
}
void TH()
{
double h=ham-tem;
double e=(h/0.5555)+10.0;
double a=e/6.11;
double b=log(a);
double c=b/5417.7530;
double d=(1.0/273.16)-c;
dew=(1.0/d)-273.16;
}
void DH()
{
double e=6.11 * exp (5417.7530 * ((1.0/273.16) - (1.0/(dew+273.16))));
double h=0.5555*(e-10.0);
tem=ham-h;
}
int main()
{
char a,b;
double x,y;
while(cin>>a)
{
if(a=='E') break;
cin>>x>>b>>y;
int k,t;
for(int i=0;i<3;i++)
{
if(a==s[i]) k=i;
if(b==s[i]) t=i;
}
if(k==0&&t==1) { tem=x; dew=y; TD();}
else if(k==1&&t==0) {dew=x; tem=y; TD();}
else if(k==0&&t==2) { tem=x; ham=y; TH();}
else if(k==2&&t==0) {ham=x; tem=y; TH();}
else if(k==1&&t==2) {dew=x; ham=y; DH();}
else if(k==2&&t==1) { ham=x; dew=y; DH();}
printf("T %.1f D %.1f H %.1f\n",tem,dew,ham);
}
return 0;
}
POJ 3299
最新推荐文章于 2022-04-08 02:24:42 发布