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 sunshinelims at 2008-01-12 20:09:02 on Problem 1005
#include <iostream.h>
#include <math.h>

void main()
{
	int a = 0, i = 0;
	cin >> a;
	float * x = new float [ a ];
	float * y = new float [ a ];
	for ( int j = 0; j < a; j++ )
	{
		x [ j ] = 0;
		y [ j ]= 0;
	}
	for ( ; i < a; i++ )
	{
		cin >> x [ i ] >> y [ i ];
	}
	i = 0;
	while ( i < a )
	{
		float k = 0;
		while ( 1 )
		{
			k += 1;
			float b = sqrt ( 100 *  k / 3.14 );
			if ( b > x [ i ] && b > y [ i ] )
			{
				cout << "Property " << i + 1 << ": This property will begin eroding in year " << k << "." << endl;
				i += 1;
				break;
			}
		}
	}
	cout << "END OF OUTPUT.";
	delete [] x;
	delete [] y;
}

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