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:为什么老说是presentation error 大虾们帮帮忙!!

Posted by fantasyorg at 2007-09-30 13:40:05 on Problem 1663
In Reply To:为什么老说是presentation error 大虾们帮帮忙!! Posted by:cpp051000448166 at 2005-04-02 18:17:48
#include<iostream>
using namespace std;

int main()
{
	int times, a, b;
	
	cin >> times;
	for (int i = 0; i < times; i ++)
	{
		cin >> a >> b;
		
		if (a - b != 0 && a - b != 2)
			cout << "No Number" << endl;
		else if (a - b == 2)
		{
			if (a % 2 == 0)
				cout << 2*a - 2 << endl;
			else
				cout << a/2*4 - 1 << endl;
		}
		else if (a - b == 0)
		{
			if (a % 2 == 0)
				cout << 2*a << endl;
			else 
				cout << a/2*4 + 1 << endl;
		}
	}
	
	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