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:Why so many WAs!In Reply To:Why so many WAs! Posted by:xuguangshengqq at 2007-07-28 00:07:37 WA:!!!!!!!!!!!!!!! Tell Me Why? #include <iostream.h> #include <stdlib.h> #include <math.h> double e,humidex,temperature,h,dewpoint; void main() { char temp,temp1,temp2; int a; int b,i; bool fa,fb,fc; while(1) { fa = false; fb = false; fc = false; for(i=1;i<=2;i++) { cin>>temp; if(temp == 'E') return; else if(temp == 'T') cin>>temperature; else if(temp == 'D') cin>>dewpoint; else if(temp == 'H') cin>>humidex; else{} if(i==1)temp1 = temp; if(i==2)temp2 = temp; } if((temp1 == 'T'&&temp2 == 'D')||(temp2 == 'T'&&temp1 == 'D')) { e = 6.11*exp(5417.7530*((1.0/273.16) - (1.0/(dewpoint+273.16)))); ///e = 6.11*pow(2.718281828,(5417.7530*((1/273.16) - (1/(dewpoint+273.16))))); h = (0.5555)*(e - 10.0); humidex = temperature + h; } else if((temp1 == 'T'&&temp2 == 'H')||(temp2 == 'T'&&temp1 == '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)))); // e = 6.11*pow(2.718281828,(5417.7530*((1/273.16) - (1/(dewpoint+273.16))))); h = (0.5555)*(e - 10.0); temperature = humidex - h; } a = (int)(100.0*temperature); b = a%10; if(b>=5) a+=10; temperature = ((double)(a/10))/10.0; if((a/10)%10==0)fa = true; a = (int)(100.0*dewpoint); b = a%10; if(b>=5) a+=10; dewpoint = ((double)(a/10))/10.0;// if((a/10)%10==0)fb = true; a = (int)(100.0*humidex); b = a%10; if(b>=5) a+=10; humidex = ((double)(a/10))/10.0; if((a/10)%10==0)fc = true; cout<<"T "<<temperature; if(fa)cout<<".0"; cout<<" D "; cout<<dewpoint; if(fb)cout<<".0"; cout<<" H "; cout<<humidex; if(fc)cout<<".0"; cout<<endl; } return; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator