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 <cstdio> const int maxn=1100; int a[maxn],sum[maxn],n,p,c,x; int main() { freopen("p2189.in","r",stdin); freopen("p2189.out","w",stdout); scanf("%d%d%d",&n,&p,&c); for (int i=1;i<=n;i++) { scanf("%d",&x); if (x!=p) a[x+1]++; else a[p]++; } sum[0]=0; p++; a[p]=0; for (int i=1;i<=p;i++) sum[i]=sum[i-1]+a[i]; int max=0; for (int i=1;i<p;i++) for (int j=i;j<p;j++) if (sum[j+1]-sum[i-1]<=c && j-i+1>max) max=j-i+1; printf("%d\n",max); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator