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

纯枚举就能过啊,献上代码

Posted by kirsten0302 at 2009-08-02 22:33:49 on Problem 1663
#include <iostream>
using namespace std;

int main ()
{
	int a,b,k,i;
	cin>>k;

	for (i=0;i<k;i++)
		
	{
		cin>>a>>b;
		if (a==b&&a%2==0)
		{
			cout<<a*2<<endl;
			continue;
		}
		if (a==b&&a%2==1)
		{
			cout<<(a-1)*2+1<<endl;
			continue;
		}

		if (a==(b+2)&&a%2==0)
		{
			cout<<(a-1)*2<<endl;
			continue;
		}
		if (a==(b+2)&&a%2==1)
		{
			cout<<(a-2)*2+1<<endl;
			continue;
		}
		if (a!=b+2&&a!=b)
		{
			cout<<"No Number"<<endl;
			continue;
		}
	}
	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