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 lyc1989 at 2009-06-09 14:12:26 on Problem 1663
#include<iostream>
using namespace std;
int main()
{
	int t,x,y;
	cin>>t;
	while(t--)
	{
		cin>>x>>y;
		if (x==y)
		{
            if(x%2)cout<<2*x-1<<endl;
			else cout<<2*x<<endl;
		}
		else if (x-2==y)
		{
			if(x%2)cout<<2*x-3<<endl;
			else cout<<2*x-2<<endl;

		}
		else 
		{
			cout<<"No Number\n";
		}
	}
	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