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 |
各位大哥帮小弟看一下,哪错了?#include<stdio.h> #include<math.h> #define min(x,y) x<y?x:y __int64 f(int i,int j,int r,int t,int a[][8]){ __int64 s; int u,v,w=0; for(u=i;u<=r;u++) for(v=j;v<=t;v++) w+=a[u][v]; s=w*w; return s;} __int64 g(int i,int j,int r,int t,int a[][8],int n){ __int64 s,b[100]; int u,v,e,w=0; if(n==1)s=f(i,j,r,t,a); else{for(u=i;u<r;u++) for(v=j;v<t;v++) b[w++]=min(min(g(i,j,u,t,a,n-1)+f(u+1,j,r,t,a),g(u+1,j,r,t,a,n-1)+f(i,j,u,t,a)), min(g(i,j,r,v,a,n-1)+f(i,v+1,r,t,a),g(i,v+1,r,t,a,n-1)+f(i,j,r,v,a))); s=b[0]; for(e=0;e<w-1;e++)s=min(b[e],s);} return s;} main(){int n,i,j,a[8][8]; __int64 r,t; double m,c,d; scanf("%d",&n); for(i=0;i<8;i++) for(j=0;j<8;j++) scanf("%d",&a[i][j]); r=f(0,0,7,7,a); t=g(0,0,7,7,a,n); m=(r+0.0)/(n*n); c=(t+0.0)/n; d=sqrt(c-m); printf("%.3lf\n",d); while(1); } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator