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 |
N条线所能画出的交点数介于N-1到N*(N-1)/2之间,且任给N-1到N*(N-1)/2之间的一个数都可以作出所要的图。另外N条线交于M个顶点可将平面最多分为N+M+1部分,这样分析对不对啊?可我提交了wrong answer,来看看啊!利用题中的数据都有正确的结果,求数据啊,以下是我的代码#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator