Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么总是WA?

Posted by 10jschen at 2012-03-10 16:06:28 on Problem 3299
#include <cstdio>
#include <cmath>
using namespace std;

int main()
{
    float h;
    float temperature, humidex, dewpoint, e, fa, fb;
    char a, b;
    while((scanf("%c", &a) != EOF) && (a != 'E'))
    {
           scanf("%f%c%f", &fa, &b, &fb);
           temperature = 0;
           humidex = 0;
           dewpoint = 0;         
           switch(a)
           {
                  case 'T': temperature = fa;
                            if(b == 'D')
                            {
                                 dewpoint = fb;   
                                 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 
                            {
                                 humidex = fb;  
                                 h = humidex - temperature;
                                 e = h / 0.5555 + 10.0;
                                 dewpoint = (1.0 /((1.0 / 273.16) - log(e / 6.11) / 5417.7530)) - 273.16;   
                            }
                            break;
                  case 'D': dewpoint = fa; 
                            if(b == 'T')
                            {
                                 temperature = fb;  
                                 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 
                            {
                                 humidex = fb; 
                                 e = (6.11 * exp(5417.7530 * ((1.0 / 273.16) - (1.0 / (dewpoint + 273.16)))));
                                 h = 0.5555 * (e - 10.0);
                                 temperature = humidex - h;    
                            }
                            break;
                  case 'H': humidex = fa;
                            if(b == 'T')
                            {
                                 temperature = fb; 
                                 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 
                            {
                                 dewpoint = fb;  
                                 e = (float)(6.11 * exp(5417.7530 * ((1.0 / 273.16) - (1.0 / (dewpoint + 273.16)))));
                                 h = 0.5555 * (e - 10.0);
                                 temperature = humidex - h;   
                            }
                            break;         
           }           
           printf("T %.1f D %.1f H %.1f\n", temperature, dewpoint, humidex);
    }
    return 0;    
}


Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator