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 |
此题有问题,同样的代码C++AC,G++WA(附代码)#include<stdio.h> #include<stdlib.h> #include<math.h> void td(double t,double d){//题目给的是T和D double p,e,h; //p=5417.7530 * ((1/273.16) - (1/(d+273.16))); e=6.11*exp(5417.7530 * ((1/273.16) - (1/(d+273.16)))); h=(0.5555)*(e - 10.0)+t; printf("T %.1lf D %.1lf H %.1lf\n",t,d,h); } void th(double t,double h){//题目给的是T和h double e,d; e=(h-t)/0.5555+10.0; d=1/(1.0/273.16-log(e/6.11)/5417.7530)-273.16; printf("T %.1lf D %.1lf H %.1lf\n",t,d,h); } void dh(double d,double h){//题目给的是D和H double e,t; e=6.11*exp(5417.7530 * ((1/273.16) - (1/(d+273.16)))); t=h-(0.5555)*(e - 10.0); printf("T %.1lf D %.1lf H %.1lf\n",t,d,h); } int main() { char c,c1; while(scanf("%c",&c)!=EOF){ if(c=='E') break; double t,d; scanf("%lf %c %lf",&t,&c1,&d); if(c=='T'&&c1=='D') td(t,d); else if(c=='D'&&c1=='T') td(d,t); else if(c=='D'&&c1=='H') dh(t,d); else if(c=='H'&&c1=='D') dh(d,t); else if(c=='T'&&c1=='H') th(t,d); else th(d,t); getchar();//接受最后一个回车符 } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator