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 |
Re:这水好怪异。。明明说不能超过5000,开始都加了这条件。。一直WA,把那条件移除。AC。。怪异~~In Reply To:这水好怪异。。明明说不能超过5000,开始都加了这条件。。一直WA,把那条件移除。AC。。怪异~~ Posted by:NARUTOACM at 2009-09-11 21:42:44 #include<stdio.h> main() { int i; int j; int a,b; int result; scanf("%d",&i); for(j=0;j<i;j++) { scanf("%d %d",&a,&b); if(a==b) { if(a%2==0) { result=2*a; } else { result=2*a-1; } printf("%d\n",result); } if(a-b==2) { if(a%2==0) { result=2*a-2; } else { result=2*a-3; } printf("%d\n",result); } if(a!=b&&a-b!=2) { printf("No Number\n"); } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator