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 shengrang at 2014-12-27 14:14:00 on Problem 3299
这个题是知道2个根据公式求第三个,,刚开始做以为是告诉你T和D求H..
送了无数的WA

下面代码

#include <stdio.h>
#include <math.h>
int main()
{
    float t,d,h;
    char c1, c2;
    float x, y;
    while(scanf ( " %c", &c1 ) , c1 != 'E')
    {
        scanf ( "%f %c%f", &x, &c2, &y );
        t = d = h = 0;
        if(c1=='T')
            t = x;
        else if(c1=='D')
            d = x;
        else if(c1=='H')
            h = x;
        if(c2=='T')
            t = y;
        else if(c2=='D')
            d = y;
        else if(c2=='H')
            h = y;
        if(t==0)
        {
            t = h - 0.5555*(6.11*exp(5417.7530*(1/273.16-(1/(d+273.16))))-10.0);
        }
        if(d==0)
        {
            d = (h-t)/0.5555+10.0;
            d = d/6.11;
            d = log(d);
            d = d/5417.7530;
            d = 1/273.16 - d;
            d = 1/d-273.16;
        }
        if(h==0)
        {
            h = t + 0.5555*(6.11*exp(5417.7530*(1/273.16-(1/(d+273.16))))-10.0);
        }
        printf ( "T %.1f D %.1f H %.1f\n", t, d, h );
    }
    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