| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
为什么总是超时?#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator