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 dingdongsheng at 2008-10-19 18:39:58 on Problem 2478
#include<stdio.h>
void main()
{
	__int64 m, n;
	__int64 t;

	while(scanf("%I64d",&m),m)
	{
		if(m==2)
		{
			printf("1\n");
			continue;
		}
		if(m==3)
		{
			printf("3\n");
			continue;
		}
		if(m==4)
		{
			printf("5\n");
			continue;
		}
		
		if(m>4)
		{
			if(m%2==1)
			{
                n=m/2;
				t=2*(n+1)*n-2*n+1;
				printf("%I64d\n",t);
				continue;
			}
			else
			{
				n=m/2-1;
				t=2*(n+1)*n+1;
				printf("%I64d\n",t);
			}
		}
	}
}

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