| ||||||||||
| 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 a[1001],n,p,c,x,i,ans,temp;
int main(){
int count,j;
scanf("%d%d%d",&n,&p,&c);
for(i=1;i<=n;i++){
scanf("%d",&x);
a[x]++;
}
temp=0;
ans=0;
count=0;
for(i=1;i<p;i++){
temp=0;
for(j=i;j<p;j++){
temp+=a[j];
if(c<temp){
if(ans<j-i)
ans=j-i;
break;
}
}
if(j==p&&ans<j-i)
ans=j-i;
}
printf("%d\n",ans);
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