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 |
把ti=-ti 更好做 不容易出错In Reply To:Re:求助?(有代码) Posted by:tcxgsy at 2005-08-12 14:49:22 > 我少考虑情况了,但是我将另一种情况加进来后仍然不对。 > #include"string.h" > #include"stdio.h" > #include"math.h" > #define cw 4.19 > #define ci 2.09 > #define temp 335 > > void main() > { double mw,mi,tw,ti; > > scanf("%lf%lf%lf%lf",&mw,&mi,&tw,&ti); > while(mw||mi||tw||ti) > { > if((mw*cw*tw)>((-mi*ci*ti)+temp*mi)) > printf("0.0 g of ice and %.1lf g of water at %.1lf C\n",(mw+mi), > ((mw*cw*tw+mi*ci*ti-temp*mi)/(mw*cw+mi*cw))); > else if((-mi*ci*ti)<(mw*cw*tw+mw*temp)) > { if(ti==0&&tw==0) > printf("%.1lf g of ice and %.1lf g of water at 0.0 C\n",mi,mw); > if(mw*cw*tw>(-mi*ci*ti)) > printf("%.1lf g of ice and %.1lf g of water at 0.0 C\n",(mi-(mw*cw*tw+mi*ci*ti)/335),(mw+(mw*cw*tw+mi*ci*ti)/335)); > else printf("%.1lf g of ice and %.1lf g of water at 0.0 C\n",(mi+(-mw*cw*tw-mi*ci*ti)/335),(mw-(-mw*cw*tw-mi*ci*ti)/335)); > } > else printf("%.1lf g of ice and 0.0 g of water at %.1lf C\n",(mw+mi), > ((mw*cw*tw+mw*temp+mi*ci*ti)/(mi*ci+mw*ci))); > scanf("%lf%lf%lf%lf",&mw,&mi,&tw,&ti); > > } > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator