POJ 3299 模拟
水题,但是WA了一屏………
swap的时候忘了把读入的数字也swap了………………………..【尴尬】
// by SiriusRen
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
char jya,jyb;
double T,D,H,xx,yy,e,h;
int main(){
while(1){
scanf("%c",&jya);
if(jya=='E')break;
scanf("%lf %c %lf",&xx,&jyb,&yy);getchar();
if((jya=='D'&&jyb=='T')||(jya=='H'&&jyb=='D')||(jya=='H'&&jyb=='T'))swap(jya,jyb),swap(xx,yy);
if(jya=='T'&&jyb=='D'){
T=xx;D=yy;
e=6.11*exp(5417.7530*((1.0/273.16)-(1.0/(D+273.16))));
h=0.5555*(e-10.0);
H=T+h;
printf("T %.1f D %.1f H %.1f\n",T,D,H);
}
else if(jya=='D'&&jyb=='H'){
D=xx;H=yy;
e=6.11*exp(5417.7530*((1.0/273.16)-(1.0/(D+273.16))));
h=0.5555*(e-10.0);
T=H-h;
printf("T %.1f D %.1f H %.1f\n",T,D,H);
}
else if(jya=='T'&&jyb=='H'){
T=xx,H=yy;
h=H-T;
e=h/0.5555+10.0;
D=1.0/((1.0/273.16)-log(e/6.11)/5417.7530)-273.16;
printf("T %.1f D %.1f H %.1f\n",T,D,H);
}
}
}