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

请帮我看一下。。为什么这样是WA?能不能帮忙找一个反例?谢谢谢谢。。。。(附代码)

Posted by Noel at 2007-03-21 15:27:21 on Problem 2363
#include<cstdio>
#include<cmath>
int h,i,j,k,m,n,t;
void main()
{
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d",&n);
		if(n>1)
		{
			for(h=k=int(pow(double(n),0.333333333333));n%k;k--); //向下取第一个能被整除的。
			for(h++;n%h;h++);  //向上取第一个能被整除的。
			m = n/k;
			n /= h;
			for(j=int(sqrt(m)+0.5);m%j;j--);
			m /= j;
			m = m*(j+k)+j*k;    //求第一组面积。
			for(j=int(sqrt(n)+0.5);n%j;j--);
			n /= j;
			n = n*(j+h)+j*h;    //求第二组面积
			if(m>n) m=n;   //取面积较小的一组输出。
			printf("%d\n",m*2);
		}
		else if(!n) printf("0\n");
		else printf("6\n");
	}
}

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