POJ 3299 Humidex

/**************************************
Problem: POJ 3299 Humidex
Time: 0MS
Memory: 184K 
Accepted Time: 2009-05-15 13:09:04
Tips: 
*************************************
*/

#include 
<stdio.h>
#include 
<math.h>
double t,d,h;
double td2h()
{
    
return t+0.5555*(6.11*pow(2.718281828,5417.7530*((1/273.16)-(1/(d+273.16))))-10.0);
}

double dh2t()
{
    
return h-0.5555*(6.11*pow(2.718281828,5417.7530*((1/273.16)-(1/(d+273.16))))-10.0);
}

double th2d()
{
    
return 1/((1/273.16)-log(((h-t)/0.5555+10.0)/6.11)/5417.7530)-273.16;
}

int main()
{
    
char str[5];
    
int tf,df,hf;
    
double temp;
    
while(1)
    
{
        tf
=df=hf=0;
        scanf(
"%s",str);
        
if(str[0]=='E')break;
        scanf(
"%lf",&temp);
        
if(str[0]=='T')tf=1,t=temp;
        
else if(str[0]=='D')df=1,d=temp;
        
else if(str[0]=='H')hf=1,h=temp;
        scanf(
"%s%lf",str,&temp);
        
if(str[0]=='T')tf=1,t=temp;
        
else if(str[0]=='D')df=1,d=temp;
        
else if(str[0]=='H')hf=1,h=temp;
        
if(tf&&df)printf("T %.1lf D %.1lf H %.1lf\n",t,d,td2h());
        
else if(df&&hf)printf("T %.1lf D %.1lf H %.1lf\n",dh2t(),d,h);
        
else if(tf&&hf)printf("T %.1lf D %.1lf H %.1lf\n",t,th2d(),h);
    }

    
return 0;
}

posted @ 2009-05-16 11:57  主函数  阅读(331)  评论(0编辑  收藏  举报