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

help! 为什么我不对

Posted by 200593174 at 2006-08-08 17:26:15 on Problem 1067
//*******************
//*  200593174      *
//* 08/07/2006      *
//*******************
#include <iostream>

using namespace std;

void changer ( int&, int& );
bool bDeside ( int nummber1, int number2 );
          
void main ()
{
	int num1,num2;

	while ( cin >> num1 >> num2 )
	{

		changer ( num1, num2 );
//	if ( num1 <= 0 )
//	{
//		cout <<"You Enter the wrong number";
//		continue;
//	}
	cout << static_cast< int >( bDeside ( num1, num2 ) ) <<endl;
	}
}	

//**************
//*    changer  *
//**************
void changer ( int& integer1, int& integer2 )
{
	if ( integer1 > integer2 )
	{
		int hold = integer1;
		integer1 = integer2;
		integer2 = hold;
	}
	return;
}

//判断
//************
//** bDeside *
//************
bool bDeside ( int number1, int number2 )
{
	int counter = 1;          //差
	int in = 1;          //记载数组
	int integer = 1;    //记载小值
	 
	if ( number1 == number2 )
	{
		return true;
	}
	int iSize = number2 - number1;
	int *iArray = new int[iSize + 1];
	for ( ; counter <= iSize; counter++ )
	{
		if ( integer > number1)
		{
			return true;
		}
		while ( integer == iArray[in])
		{
			integer++;
			in++;
		}
		
		iArray[counter] = integer + counter;
		integer++;
	}
	if ( iArray[counter - 1] < number2 )
	{
		return true;
	}
	return false;
	delete [] iArray;
}

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