| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:为什么我用C提交AC了,用GCC提交就WA了??在我的代码里面哪里会导致编译器的差别?原代码如下。。In Reply To:为什么我用C提交AC了,用GCC提交就WA了??在我的代码里面哪里会导致编译器的差别?原代码如下。。 Posted by:aswmtjdsj at 2010-06-06 13:23:48 #include <stdio.h>
#include <math.h>
int main()
{
double dewpoint,e,h,temperature,humidex;
char c1,c2;
scanf(" %c",&c1);
while(c1!='E')
{
if(c1=='T')
scanf("%lf",&temperature);
else if(c1=='D')
scanf("%lf",&dewpoint);
else
scanf("%lf",&humidex);
scanf(" %c",&c2);
if(c2=='T')
scanf("%lf",&temperature);
else if(c2=='D')
scanf("%lf",&dewpoint);
else
scanf("%lf",&humidex);
if((c1=='T'&&c2=='D')||(c2=='T'&&c1=='D'))
{
e = 6.11* exp(5417.7530 *((1.0/273.16) - (1.0/(dewpoint+273.16))));
h = (0.5555)* (e - 10.0);
humidex = temperature + h ;
}
else if((c1=='T'&&c2=='H')||(c2=='T'&&c1=='H'))
{
h=humidex-temperature;
e= h / 0.5555 + 10.0;
dewpoint = 1.0/((1.0/273.16) - log(e/6.11)/5417.7530) - 273.16 ;
}
else
{
e = 6.11* exp(5417.7530 *((1.0/273.16) - (1.0/(dewpoint+273.16))));
h = (0.5555)* (e - 10.0);
temperature =humidex - h ;
}
printf("T %.1f D %.1f H %.1f\n",temperature,dewpoint,humidex);//这里改一下就可以AC啦!
scanf(" %c",&c1);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator