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 huatao at 2008-04-05 18:28:01 on Problem 3250
#include <iostream>
using namespace std;
int main()
{
	int n;
	int i, j;
	int c = 0;
	int *a = NULL;
	cin>>n;
	a = new int[n];
	for (i=0; i<n; i++)
	{
		cin>>a[i];
	}
	for (i=0; i<n-1; i++)
	{
			for (j=i+1; j<n && a[j]<a[i]; j++)
			{
				;
			}
				c += j-i-1;
	}
	cout<<c<<endl;
	delete[] a;
	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