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

很简单,就是推公式的时候别推错了。用来调节心情比较好使。

Posted by bupt_chen at 2008-07-13 17:11:34 on Problem 3299
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    char ch1,ch2;
    double temperature, dewpoint, humidex;
    while(cin >> ch1 && ch1!='E')
    {
        switch(ch1)
        {
            case 'T':
                cin >> temperature;
                break;
            case 'D':
                cin >> dewpoint;     
                break;
            case 'H':
                cin >> humidex;
                break;       
            default:
                break;    
        }
        
        cin >> ch2;
        
        switch(ch2)
        {
            case 'T':
                cin >> temperature;
                break;
            case 'D':
                cin >> dewpoint;     
                break;
            case 'H':
                cin >> humidex;
                break;       
            default:
                break;        
        }
        if((ch1=='T'&&ch2=='D')||(ch1=='D'&&ch2=='T'))
        {
            double e = 6.11 * exp (5417.7530 * ((1/273.16) - (1/(dewpoint+273.16))));
            double h = (0.5555)*(e - 10.0); 
            humidex = temperature + h;           
        }
        else if((ch1=='T' &&ch2=='H') ||(ch1=='H' &&ch2=='T'))
        {
            double h = humidex - temperature;
            double e= h/(0.5555)+10.0;
            dewpoint = 1/(1/273.16-(log(e/6.11))/5417.7530)-273.16;      
        }                      
        else if((ch1=='D'&&ch2=='H') || (ch1=='H' && ch2=='D') )
        {
            double e = 6.11 * exp (5417.7530 * ((1/273.16) - (1/(dewpoint+273.16))));
            double h = (0.5555)*(e - 10.0); 
            temperature = humidex - h;                      
        } 
        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