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 pb__xy at 2007-07-10 10:57:10 on Problem 1191
#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:
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