| ||||||||||
| 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>
int first[10001];
int main()
{
int n,k,i,j;
while(scanf("%d%d",&n,&k))
{
if(n==-1&&k==-1)
break;
for(i=0;i<=n;++i)
scanf("%d",&first[n-i]);
if(k==0)
{
printf("%d\n",0);
continue;
}
for(i=0;i<=n-k;++i)
{
if(first[i]==0)
continue;
first[i+k]-=first[i];
first[i]=0;
}
for(j=n-k+1;j<n;++j)
{
if(first[j]!=0)
break;
}
for(i=n;i>=j;--i)
{
printf("%d",first[i]);
if(i>j) printf(" ");
else printf("\n");
}
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator