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

O(nm^3)都0ms

Posted by Hoblovski at 2013-11-07 21:16:28 on Problem 1664
数据求加强 
或者求把我加强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:
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