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 alpc25 at 2006-04-01 10:51:29 on Problem 2363
#include<stdio.h>
int N,n,i,h,s,s1;
int main()
{
	scanf("%d",&N);
	while(N--)
	{
		s=1000000000;
		scanf("%d",&n);
		for(i=1;i<=n;i++)
		{
			if(n%(i*i)==0) {h=n/(i*i);s1=i*i*2+i*h*4;}
            if(s1<s) s=s1;
		}	    
		if(n%2==0) {h=n/2;s1=4+h*2+4*h;}
		if(s1<s) s=s1;
		if(n==0) s=0;
	    printf("%d\n",s);
	}
	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