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 |
Re:为什么我这样错的啊In Reply To:为什么我这样错的啊 Posted by:suhang at 2010-01-24 12:29:41 > #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