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

好人看看哪个数据不对.郁闷

Posted by bjtuacmer200701 at 2007-09-06 16:48:15 on Problem 1923
#include<stdio.h>
#define MAX 102
int flags[MAX+1][(MAX+1)*MAX/2]={0};
int main()
{
    int i,j,k;
    for(i =1;i<=MAX;i++)
	{
        flags[i][0] =i+1;
        for(j =1;j<i;j++)
		{
			for(k =0;k<=(i-j)*(i-j-1)/2;k++)                
			{
				if(flags[i][j*(i-j)+k]<flags[i-j][k]+(i-j+1)*j)
				   flags[i][j*(i-j)+k]=flags[i-j][k]+(i-j+1)*j;
			}
		}
    }
	k=1;
	while(scanf("%d %d",&i,&j)&&(i+j))
	{
		if(flags[i][j])
			printf("Case %d: %d lines with exactly %d crossings can cut the plane into %d pieces at most.\n",k,i,j,flags[i][j]);
		else printf("Case %d: %d lines cannot make exactly %d crossings.\n",k,i,j);
		k++;
    }
    return 0;
}

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