POJ-3299 原题链接
题目意思是按照给出公式由两个数求第三个数
英语太差 一开始以为是给出d和t,求h,提交好多次,哭哭
ac代码:
#include <iostream>
#include <stdlib.h>
#include <cstdio>
#include <cmath>
using namespace std;
int main(int argc, char *argv[]){
double H, D, T, e;
bool h, t, d;
char c;
while(cin>>c&&c!='E'){
h = t = d = true;
switch(c){
case 'H': h = false; cin>>H; break;
case 'D': d = false; cin>>D; break;
case 'T': t = false; cin>>T; break;
}
cin>>c;
switch(c){
case 'H': h = false; cin>>H; break;
case 'D': d = false; cin>>D; break;
case 'T': t = false; cin>>T; break;
}
if(t)
T=H-0.5555*(6.11*exp(5417.7530*((1/273.16)-(1/(D+273.16))))-10.0);
else if(d)
D=1/(1/273.16-log(((H-T)/0.5555+10)/6.11)/5417.7530)-273.16;
else
H=T+0.5555*(6.11*exp(5417.7530*((1/273.16)-(1/(D+273.16))))-10.0);
printf("T %.1f D %.1f H %.1f\n",T, D, H);
}
return 0;
}