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> #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: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator