Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:此题真的很水,发现规律很容易ac,不用开数组,也不用循环。。哈哈

Posted by qylsw at 2010-07-09 21:08:15 on Problem 1663
In Reply To:此题真的很水,发现规律很容易ac,不用开数组,也不用循环。。哈哈 Posted by:cschenlu at 2009-08-27 20:08:47
#include<iostream>
using namespace std;
int main()
{
	int n;
	scanf("%d",&n);
	while(n--){
		int x,y;
		scanf("%d%d",&x,&y);
		if(y>x||(x==1&&y==0)||x-y==1||x-y>2)  printf("No Number\n");
		else {
			if(x%2==0) printf("%d\n",x+y);
		    else printf("%d\n",x+y-1);
		}
	}
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator