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

Re:呵呵,真的是好简单啊,这样就过了

Posted by PC0400322032 at 2004-07-22 01:37:43 on Problem 1398
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator