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为什么一直是WA啊,我的结果都对啊。难道是输出格式错误? CODE: #include<stdio.h> #include<stdlib.h> main() { double a,b,c,d,i,j,k,s,x; int l; scanf("%lf %lf %lf %lf",&a,&b,&c,&d); while(a!=0||b!=0||c!=0||d!=0) { i=a*c*4.19,j=b*(0-d)*2.09,x=a*355,k=355*b; if(i>j+k) l=1; else { if (i+x<j) l=-1; else l=0;} switch (l) { case 1: {s=(4.19*a*c+2.09*b*d-335*b)/(4.19*b+4.19*a); printf("0.0 g of ice and %.1lf g of water at %.1lf C\n",a+b,s);break;} case 0:{s=(4.19*a*c-2.09*b*(0-d))/335; printf("%.1lf g of ice and %.1lf g of water at 0.0 C\n",b-s,a+s);break;} case -1:{s=(2.09*b*d+335*a+4.19*a*c)/(2.09*a+2.09*b); printf("%.1lf g of ice and 0.0 g of water at %.1lf\n",a+b,s);} } scanf("%lf %lf %lf %lf",&a,&b,&c,&d); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator