Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:pow前加个ceil就AC了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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator