您的位置:首页 > 其它

poj水题--ID3299

2012-10-18 15:14 288 查看
不贴题目了,描述的很复杂,其实这个题主要是考察简单的逻辑设计问题吧,看了其他人的答案,有的地方没看懂,还是用麻烦的if else解决的:

#include<iostream>
#include<iomanip>
#include<math.h>
using namespace std;
int main()
{
char a;
double t,d,h;
while(cin>>a&&a!='E')
{
if(a=='T')
{
cin>>t>>a;
if(a=='D')
{cin>>d;
h=t+0.5555*(6.11*exp(5417.7530*(1/273.16-1/(d+273.16)))-10); }
else
{
cin>>h;
d= 1/((1/273.16)-((log((((h-t)/0.5555)+10.0)/6.11))/5417.7530))-273.16;
}
}
else if(a=='D')
{
cin>>d>>a;
if(a=='T')
{cin>>t;
h=t+0.5555*(6.11*exp(5417.7530*(1/273.16-1/(d+273.16)))-10);
}
else
{
cin>>h;
t=h-0.5555*(6.11*exp(5417.7530*(1/273.16-1/(d+273.16)))-10);
}
}
else
{
cin>>h>>a;
if(a=='D')
{
cin>>d;
t=h-0.5555*(6.11*exp(5417.7530*(1/273.16-1/(d+273.16)))-10);
}
else
{
cin>>t;
d= 1/((1/273.16)-((log((((h-t)/0.5555)+10.0)/6.11))/5417.7530))-273.16;
}
}
cout.setf(ios::fixed);
cout<<setprecision(1)<<"T "<<t<<" "<<"D "<<d<<" "<<"H "<<h<<endl;

}

}


  成功AC了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: