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 |
知道这两种情况有什么不同么???while(1) { if(m>l||n>l) break; if(m*1.0/(n*1.0)>=a)n++; else m++; if(fabs(a-x*1.0/(1.0*y))>fabs(a-m*1.0/(n*1.0))) { x=m; y=n; } } printf("%d %d\n",x,y); while(1) { if(m>l||n>l) break; if(fabs(a-x*1.0/(1.0*y))>fabs(a-m*1.0/(n*1.0))) { x=m; y=n; } if(m*1.0/(n*1.0)>=a)n++; else m++; } printf("%d %d\n",x,y); 刚开始以为这两种情况一样,可是我同学他的能过我的就WA,,,, 后来找了好久用1一测就发现,上面 输出的是1 1而我的是2 2,这就是差别!!!!!!!!! Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator