poj上的一道简单题但是一直WRONG ANSWER,,求助啊!!(有赏金) 5
这是原题地址http://poj.org/problem?id=3299是用c语言写的,新手上路写的比较冗余,望大神知道批评,以下是代码:#include<stdio.h...
这是原题地址http://poj.org/problem?id=3299
是用c语言写的,新手上路写的比较冗余,望大神知道批评,以下是代码:
#include<stdio.h>
#include<math.h>
int main()
{
char a,b;
double h,d,t,x,y,e;
while((a=getchar())!='E')
{
scanf("%*c%lf%*c%c%*c%lf%*c",&x,&b,&y);
if(x>100||x<-100||y<-100||y>100)
break;
if(a=='T')
{
t=x;
if(b=='D')
{
d=y;
h=t+0.5555*(6.11*exp(5417.7530*(1/273.16-1/(d+273.16)))-10);
}
else
{
h=y;
d=1/((1/273.16)-((log((((h-t)/0.5555)+10.0)/6.11))/5417.7530))-273.16;
}
}
else if(a=='D')
{
d=x;
if(b='T')
{
t=y;
h=t+0.5555*(6.11*exp(5417.7530*(1/273.16-1/(d+273.16)))-10);
}
else
{
h=y;
t=h-0.5555*(6.11*exp(5417.7530*(1/273.16-1/(d+273.16)))-10);
}
}
else if(a=='H')
{
h=x;
if(b=='D')
{
d=y;
t=h-0.5555*(6.11*exp(5417.7530*(1/273.16-1/(d+273.16)))-10);
}
else
{
t=y;
d=1/((1/273.16)-((log((((h-t)/0.5555)+10.0)/6.11))/5417.7530))-273.16;
}
}
printf("T %.1lf D %.1lf H %.1lf\n",t,d,h);
}
return 0;
} 展开
是用c语言写的,新手上路写的比较冗余,望大神知道批评,以下是代码:
#include<stdio.h>
#include<math.h>
int main()
{
char a,b;
double h,d,t,x,y,e;
while((a=getchar())!='E')
{
scanf("%*c%lf%*c%c%*c%lf%*c",&x,&b,&y);
if(x>100||x<-100||y<-100||y>100)
break;
if(a=='T')
{
t=x;
if(b=='D')
{
d=y;
h=t+0.5555*(6.11*exp(5417.7530*(1/273.16-1/(d+273.16)))-10);
}
else
{
h=y;
d=1/((1/273.16)-((log((((h-t)/0.5555)+10.0)/6.11))/5417.7530))-273.16;
}
}
else if(a=='D')
{
d=x;
if(b='T')
{
t=y;
h=t+0.5555*(6.11*exp(5417.7530*(1/273.16-1/(d+273.16)))-10);
}
else
{
h=y;
t=h-0.5555*(6.11*exp(5417.7530*(1/273.16-1/(d+273.16)))-10);
}
}
else if(a=='H')
{
h=x;
if(b=='D')
{
d=y;
t=h-0.5555*(6.11*exp(5417.7530*(1/273.16-1/(d+273.16)))-10);
}
else
{
t=y;
d=1/((1/273.16)-((log((((h-t)/0.5555)+10.0)/6.11))/5417.7530))-273.16;
}
}
printf("T %.1lf D %.1lf H %.1lf\n",t,d,h);
}
return 0;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询