| ||||||||||
| 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 | |||||||||
为什么WA呢?程序如下#include<stdio.h>
main()
{int i,j,n,k;
long a[10001];
while(scanf("%d%d",&n,&k))
{if(n==-1&&k==-1)break;
for(i=0;i<=n;i++)
scanf("%ld",&a[i]);
if(k==0){printf("%d\n",0);
continue;}
for(i=0;i<=n-k;i++)
{if(a[i]==0)i++;
if(i>n-k)break;
a[i+k]-=a[i];
a[i]=0;
}
for(j=i;j<=n;j++)
{printf("%ld",a[j]);
if(j<n)printf(" ");
else printf("\n");
}
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator