| ||||||||||
| 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 | |||||||||
为什么总wa.....?#include <stdio.h>
#include <stdlib.h>
int main()
{
int i;
float inputnum=0,temperature,dewpoint,humidex,temp,num;
char type,space;
while ((scanf ("%c",&type)==1)&&(type!='E')){
temperature=-101;dewpoint=-101;humidex=-101;
switch (type)
{
case 'T':scanf ("%f ",&temperature);break;
case 'D':scanf ("%f " ,&dewpoint);break;
case 'H':scanf ("%f ",&humidex);break;
default:return 0;
}
scanf ("%c ",&type);
if (type=='E') return 0;
switch (type)
{
case 'T':scanf ("%f",&temperature);break;
case 'D':scanf ("%f",&dewpoint);break;
case 'H':scanf ("%f",&humidex);break;
}
if (temperature==-101)
{temp=1/(dewpoint+273.16);temp=1/273.16-temp;temp=5417.7530*temp;temp=exp(temp);
temp=0.5555*(6.11*temp-10.0);temperature=humidex-temp;
}
if (dewpoint==-101)
{temp=humidex-temperature;
temp=temp/0.5555+10.0;
temp=temp/6.11;
temp=log(temp);
temp=(float)1/273.16-temp/5417.7530;
temp=1/temp;
dewpoint=temp-273.16;
}
if (humidex==-101)
{temp=1/(dewpoint+273.16);temp=1/273.16-temp;temp=5417.7530*temp;temp=exp(temp);
temp=0.5555*(6.11*temp-10.0);humidex=temperature+temp;
}
printf ("T %.1f D %.1f H %.1f\n",temperature,dewpoint,humidex);
fflush(stdin);
}
return 0;
}
给的几个测试数据都对..还有什么没考虑到的地方么?3x
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator