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 |
O(nm^3)都0ms数据求加强 或者求把我加强XD 我是傻×.只会枚举限制的递推 组合计数我至今还是用限制用得最顺手... program poj1664; var f:array[1..10,0..10,0..10] of longint; cnt:array[0..10] of longint; n,m,ans,i,caseno:longint; procedure init; begin fillchar(f,sizeof(f),0); readln(m,n); end; procedure work; var i,j,k,t:longint; begin for i:=0 to m do f[1,i,i]:=1; for i:=2 to n do for j:=0 to m do for k:=0 to j do for t:=k downto 0 do inc(f[i,j,k],f[i-1,j-k,t]); end; begin readln(caseno); while caseno>0 do begin dec(caseno); init; work; ans:=0; for i:=0 to m do inc(ans,f[n,m][i]); writeln(ans); end; end. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator