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

Re:我怎用了这个公式还超时啊!!!

Posted by lironghua at 2008-09-07 18:08:23 on Problem 3604
In Reply To:Re:我怎用了这个公式还超时啊!!! Posted by:wujiabao at 2008-07-11 10:29:43
me too
下面这样的代码就会超时:
__int64 getvalue (int n)
{
	int i,c,l;
	__int64 ans;
	l = 0;	
	for (i = 2; i < sqrt (n) + 1; i++)
	{
		c = 0;
		while (n % i == 0)
		{
			n /= i;
			c++;
		}
		if (c != 0)
			f[l++] = c;
	}
	len = l;
	ans = 1;
	for (i = 0; i < len; i++)
	{
		ans *= ((f[i] + 1) * (f[i] + 2)) * ((f[i] + 1) * (f[i] + 2));
	}
	ans >>= (len + len);
	return ans;
}

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