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 |
sum和difference 不同奇同偶时是impossible的In Reply To:Re:错了,又错了,还是错了...为什么总是wrong answer? Posted by:Maxempire at 2005-12-04 17:37:39 > 这是源程序,请哪位牛人解决一下? > #include<stdio.h> > #include<math.h> > void main(){ > int m,i,a,b,sum,difference; > scanf("%d",&m); > for(i=0;i<m;i++){ > scanf("%d %d",&sum,&difference); > if(sum<0||difference<0){ > printf("impossible\n"); > continue; > } > a=(sum+difference)/2; > b=(sum-difference)/2; > if(a<0||b<0){ > printf("impossible\n"); > continue; > } > printf("%d %d\n",a,b); > } > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator