Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## Re:WA，哪位高人帮忙看下，或弄几个边界数据测下。小弟不胜感激！

Posted by sd15wyhx at 2017-03-21 08:58:26 on Problem 2527
In Reply To:WA，哪位高人帮忙看下，或弄几个边界数据测下。小弟不胜感激！ Posted by:Alexande at 2006-03-22 22:35:16
> #include <stdio.h>
> #define Max 10002
> long Coe[Max];
>
> void main()
> {
>   int i,j,n,k,end;
>   scanf("%d %d",&n,&k);
>   while(1)
>   {
>     if(n==-1&&k==-1)
> 		break;
> 	for(i=0;i<=n;i++)
> 		Coe[i]=0;
>     for(i=0;i<=n;i++)
> 		scanf("%ld",&Coe[i]);
> 	if(k==0)
> 		printf("0\n");
> 	else
> 	{
> 	  j=n;
>       while(j>=k)
> 	  {
> 	    Coe[j-k]=Coe[j-k]-Coe[j];
> 	    Coe[j]=0;
> 	    j--;
> 	  }
>       end=0;
> 	  for(i=k-1;i>0;i--)
> 		if(Coe[i]!=0)
> 		{
> 		   end=i;
> 		   break;
> 		}
>       printf("%ld ",Coe[0]);
> 	  if(end!=0)
> 	  {
> 	   for(i=1;i<=end;i++)
> 		  printf("%ld ",Coe[i]);
> 	  }
> 	  printf("\n");
> 	}
> 	scanf("%d %d",&n,&k);
>   }
> }

Followed by: