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 |
为什么我的测试的例子过了但是总是wa阿,大家帮忙看看,我贴代码#include <stdio.h> #include <math.h> #include <string.h> #include <stdlib.h> int main() { float a,b,c,temp[2]; int flag=0; char str[40],ch[2][10],*p; memset(str,'\0',40); gets(str); while(strcmp(str,"E")!=0){ if(flag==1) printf("\n"); a=b=c=-1.1; p=strtok(str," "); strcpy(ch[0],p); p=strtok(NULL," "); temp[0]=atoi(p); p=strtok(NULL," "); strcpy(ch[1],p); p=strtok(NULL," "); temp[1]=atoi(p); if(ch[0][0]=='T') a=temp[0]; else if(ch[0][0]=='D') b=temp[0]; else c=temp[0]; if(ch[1][0]=='T') a=temp[1]; else if(ch[1][0]=='D') b=temp[1]; else c=temp[1]; if(a==-1.1) a=c+(0.5555)*(6.11*exp(5417.7530*((1/273.16)-(1/(b+273.16))))-10.0); else if(b==-1.1) b=1/(5417.753*(1/273.16)-log(((c-a)/0.555+10.0)/6.11))-273.16; else c=a+(0.5555)*(6.11*exp(5417.7530*((1/273.16)-(1/(b+273.16))))-10.0); printf("T %.1f D %.1f H %.1f",a,b,c); flag=1; gets(str); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator