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:pow前加个ceil就AC了

Posted by mayp at 2007-03-06 22:01:36 on Problem 2363
In Reply To:都已经是暴力了怎么还WA。。。 Posted by:x1e398u at 2005-11-28 14:05:52
> #include <stdio.h>
> #include <math.h>
> 
> int main()
> {
> 	int T;
> 	scanf("%d",&T);
> 	for(;T>0;T--)
> 	{
> 		int N;
> 		scanf("%d",&N);
> 		int tmp=N;
> 		if(N==0)
> 		{
> 			printf("0\n");
> 			continue;
> 		}
> 		int a=pow(N,1.0/3),b,c,min=10000;
> 		for(;a>0;a--)
> 			if(N%a==0)
> 			{
> 				int tmp=N;
> 				tmp/=a;
> 				for(b=sqrt(tmp);b>0;b--)
> 					if(tmp%b==0)
> 					{
> 						c=tmp/b;
> 						if(min>((a*b+b*c+c*a)<<1)) min=(a*b+b*c+c*a)<<1;
> 					}
> 			}
> 		printf("%d\n",min);
> 	}
> 	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