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和前面的WA不同

Posted by Johnnx at 2009-02-11 22:13:57 on Problem 3299
#include<stdio.h>
#include<math.h>
#include<stdlib.h>

typedef struct measurements{
    char P;
    float p;
}meament;

int main()
{
    meament a,b,c,swap;
    double h,e;
    while(scanf("%c",&a.P),a.P != 'E'){    
        scanf("%f %c %f",&a.p,&b.P,&b.p);
        if((a.p < -100 || a.p > 100) || (b.p > 100 || b.p < -100))
            break; 
        if((a.P == 'T' && b.P == 'D') || (a.P == 'D' && b.P == 'T')){
            if(a.P == 'D' && b.P == 'T'){
                swap.P = a.P;
                swap.p = a.p;
                a.P = b.P;
                a.p = b.p;
                b.P = swap.P;
                b.p = swap.p;
            }
            c.P = 'H';
            e = 6.11 * exp(5417.7530 * ((1/273.16) - (1/(b.p + 273.16))));
            h = 0.5555 * (e - 10.0);
            c.p = a.p + h;
            c.p= (int)(10.0 * c.p + 0.5) / 10.0;
            printf("%c %.1f %c %.1f %c %.1f\n",a.P,a.p,b.P,b.p,c.P,c.p);
        }
        if((a.P == 'T' && b.P == 'H') || (a.P == 'H' && b.P == 'T')){
            if(a.P == 'H' && b.P == 'T'){
                swap.P = a.P;
                swap.p = a.p;
                a.P = b.P;
                a.p = b.p;
                b.P = swap.P;
                b.p = swap.p;
            }
            c.P = 'D';
            h = b.p - a.p;
            e = h/0.5555 + 10.0;
            c.p = 1/((1/273.16) - (log(e/6.11))/5417.7530) - 273.16;
            c.p= (int)(10.0 * c.p + 0.5) / 10.0;
            printf("%c %.1f %c %.1f %c %.1f\n",a.P,a.p,c.P,c.p,b.P,b.p);
        }
        if((a.P == 'D' && b.P == 'H') || (a.P == 'H' && b.P == 'D')){
            if(a.P == 'H' && b.P == 'D'){
                swap.P = a.P;
                swap.p = a.p;
                a.P = b.P;
                a.p = b.p;
                b.P = swap.P;
                b.p = swap.p;
            }
            c.P = 'T';
            e = 6.11 * exp(5417.7530 * ((1/273.16) - (1/(a.p + 273.16))));
            h = 0.5555 * (e - 10.0);
            c.p = b.p - h;
            c.p= (int)(10.0 * c.p + 0.5) / 10.0;
            printf("%c %.1f %c %.1f %c %.1f\n",c.P,c.p,a.P,a.p,b.P,b.p);
        }
    }
    system("PAUSE");
    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