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:richardhuang at 2004-07-21 21:44:22 #include <stdio.h> void main(void) { int g[101][101]; int t,n,k; int i,j,l; scanf("%d",&t); while(t-->0) { scanf("%d %d",&n,&k); for(i=0;i<n;i++) scanf("%d",&g[0][i]); for(j=1;j<n;j++) for(l=0;l<n-j;l++) g[j][l]=g[j-1][l+1]-g[j-1][l]; for(l=1;l<=k;l++) g[n-1][l] = g[n-1][0]; for(i=n-2;i>=0;i--) for(l=0;l<k;l++) g[i][n-i+l] = g[i][n-i+l-1] + g[i+1][n-i+l-1]; for(i=0;i<k;i++) printf("%d ",g[0][i+n]); printf("\n"); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator