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

N条线所能画出的交点数介于N-1到N*(N-1)/2之间,且任给N-1到N*(N-1)/2之间的一个数都可以作出所要的图。另外N条线交于M个顶点可将平面最多分为N+M+1部分,这样分析对不对啊?可我提交了wrong answer,来看看啊!利用题中的数据都有正确的结果,求数据啊,以下是我的代码

Posted by lucanyi at 2008-02-24 09:39:06 on Problem 1923
#include "stdio.h"
int main()
{
	int i=0;
	while(1)
	{
		int N,M;
		scanf("%d%d",&N,&M);
		if(N==0&&M==0)
			break;
		printf("Case %d: ",++i);
		if(M<N-1||M>N*(N-1)/2)
			printf("%d lines cannot make exactly %d crossings.\n",N,M);
		else
			printf("%d lines with exactly %d crossings can cut the plane into %d pieces at most.\n",N,M,N+M+1);
	}
	return 1;
}

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