| ||||||||||
| 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<stdio.h>
//#include<windows.h>
int main()
{
int n,a[1000],b[1000],i,j;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
b[i]=i;
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(a[b[j]]<a[b[i]])
{int t=b[j];
b[j]=b[i];
b[i]=t;
}
}
//printf("%d ",b[i]);
}
int max=0,count;
for(i=0;i<n;i++)
{
j=0;count=1;
while(b[j]!=n-1)
{if(b[j]>=b[j-1]&&b[j]<=n-1)
count++;j++;
}
if(count>max)
max=count;
}
printf("%d\n",max);
//system("pause");
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator