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 |
用你的数据对拍过不了但是A了。。。。灵异事件么In Reply To:随便敲个数据……代码能力好弱,虐死了~~o(>_<)o ~~ Posted by:rayafjyblue at 2011-06-30 17:24:05 14 99 98 97 96 95 94 02 91 79 78 00 76 75 74 73 72 69 68 67 66 65 64 63 62 49 48 47 46 04 44 43 42 39 38 37 36 35 34 33 32 29 28 27 26 25 24 23 22 19 18 04 13 12 11 10 09 09 08 07 04 03 02 01 00 我的 63.832 正解 57.401 var ans:extended; used:int64; yy,n,i,j,k,l,xx:longint; dp:array[1..8,1..8,1..8,1..8,1..15] of int64; p:array[1..8,1..8] of int64; sum:array[1..8,1..8,1..8,1..8] of int64; function min(a,b:longint):longint; begin if a<b then exit(a) else exit(b); end; function find(x1,y1,x2,y2,fen:longint):longint; var i,temp:longint; begin //if x2-x1+y2-y1<fen then exit(100000000); if dp[x1,y1,x2,y2,fen]<>maxlongint then exit(dp[x1,y1,x2,y2,fen]); if fen=1 then begin dp[x1,y1,x2,y2,1]:=sum[x1,y1,x2,y2]*sum[x1,y1,x2,y2]; exit(dp[x1,y1,x2,y2,1]); end; temp:=maxlongint; for i:=x1 to x2-1 do if y2-y1+i-x1>=fen-1 then temp:=min(temp,find(x1,y1,i,y2,fen-1)+sum[i+1,y1,x2,y2]*sum[i+1,y1,x2,y2]); for i:=x1+1 to x2 do if y2-y1+x2-i>=fen-1 then temp:=min(temp,find(i,y1,x2,y2,fen-1)+sum[x1,y1,i-1,y2]*sum[x1,y1,i-1,y2]); for i:=y1 to y2-1 do if x2-x1+i-y1>=fen-1 then temp:=min(temp,find(x1,y1,x2,i,fen-1)+sum[x1,i+1,x2,y2]*sum[x1,i+1,x2,y2]); for i:=y1+1 to y2 do if x2-x1+y2-i>=fen-1 then temp:=min(temp,find(x1,i,x2,y2,fen-1)+sum[x1,y1,x2,i-1]*sum[x1,y1,x2,i-1]); dp[x1,y1,x2,y2,fen]:=temp; exit(dp[x1,y1,x2,y2,fen]); end; begin fillchar(sum,sizeof(sum),0); readln(n); for i:=1 to 8 do for j:=1 to 8 do read(p[i,j]); for i:=1 to 8 do for j:=1 to 8 do for k:=i to 8 do for l:=j to 8 do for xx:=i to k do for yy:=j to l do sum[i,j,k,l]:=sum[i,j,k,l]+p[xx,yy]; for i:=1 to 8 do for j:=1 to 8 do for k:=i to 8 do for l:=j to 8 do for xx:=1 to n do dp[i,j,k,l,xx]:=maxlongint; used:=find(1,1,8,8,n); //writeln(used); ans:=sqrt((-1*sum[1,1,8,8]*sum[1,1,8,8]/n+used)/n); writeln(ans:0:3); end. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator