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 1120112227 at 2012-05-18 16:45:15 on Problem 2000
#include <stdio.h>
int main()
{
	while(1)
	{
		int flag,ans=0;
		scanf("%d",&flag);
		if(flag==0) continue;
		else
		{
			int i;
			for(i=1;i*(i+1)/2<=flag;i++){}
			ans=(i-1)*i*(2*i-1)/6+i*(flag-(i*(i-1))/2);
		}
		printf("%d %d\n",flag,ans);
	}
	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