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 |
我的AC代码在GCC下锅不过,WA了四次,很是心痛.#include <stdio.h> #include <stdlib.h> #include <math.h> double exponent=2.718281828; double calcT(double D, double H) { double e=6.11*exp(5417.7530*((1/273.16)-(1/(D+273.16)))); double h=(0.5555)*(e - 10.0); double T=H-h; return T; } double calcD(double T, double H) { double h=H-T; double e=10.0+h/0.5555; double D=1/((1/273.16)-(log(e/6.11))/5417.7530)-273.16; return D; } double calcH(double T, double D) { double e=6.11*exp(5417.7530*((1/273.16)-(1/(D+273.16)))); double h=0.5555*(e-10.0); double H=T+h; return H; } int main(int argc, char *argv[]) { char first_char, second_char; double first_num, second_num; double T, D, H; for(;;) { scanf("%c", &first_char); if(first_char=='E') { break; } scanf("%lf %c %lf", &first_num, &second_char, &second_num); if(first_char=='T' && second_char=='D') { H = calcH(first_num, second_num); printf("T %.1lf D %.1lf H %.1lf\n", first_num, second_num, H); } else if(first_char=='D' && second_char=='T') { H = calcH(second_num, first_num); printf("T %.1lf D %.1lf H %.1lf\n", second_num, first_num, H); } else if(first_char=='T' && second_char=='H') { D = calcD(first_num, second_num); printf("T %.1lf D %.1lf H %.1lf\n", first_num, D, second_num); } else if(first_char=='H' && second_char=='T') { D = calcD(second_num, first_num); printf("T %.1lf D %.1lf H %.1lf\n", second_num, D, first_num); } else if(first_char=='D' && second_char=='H') { T = calcT(first_num, second_num); printf("T %.1lf D %.1lf H %.1lf\n", T, first_num, second_num); } else if(first_char=='H' && second_char=='D') { T = calcT(second_num, first_num); printf("T %.1lf D %.1lf H %.1lf\n", T, second_num, first_num); } } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator