POJ3299-Humidex

转载请注明出处:優YoU http://user.qzone.qq.com/289065406/blog/1299074845

 

提示:纯粹的数学公式,连推导公式都可以省了= =

 

 1 //Memory   Time 
2 //240K 0MS
3
4 #include<iostream>
5 #include<math.h>
6 #include<string>
7 #include<iomanip>
8 using namespace std;
9 int main(void)
10 {
11 char alpha;
12 double t,d,h;
13 int i;
14 for(;;)
15 {
16 t=d=h=200; //三个参数的范围默认都是在-100 ~ 100
17 for(i=0;i<2;i++)
18 {
19 cin>>alpha;
20 if(alpha=='E')
21 return 0;
22 else if(alpha=='T')
23 cin>>t;
24 else if(alpha=='D')
25 cin>>d;
26 else if(alpha=='H')
27 cin>>h;
28 }
29 if(h==200)
30 h=t+0.5555*(6.11*exp(5417.7530*(1/273.16-1/(d+273.16)))-10);
31 else if(t==200)
32 t=h-0.5555*(6.11*exp(5417.7530*(1/273.16-1/(d+273.16)))-10);
33 else if(d==200)
34 d=1/((1/273.16)-((log((((h-t)/0.5555)+10.0)/6.11))/5417.7530))-273.16;
35 cout<<setprecision(1)<<fixed<<"T "<<t<<" D "<<d<<" H "<<h<<endl;
36 }
37 return 0;
38 }

你可能感兴趣的:(ide)