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 lydliyudong at 2011-05-31 17:06:56 on Problem 3934
从大到小一个个放,试想现在该放第i个,放两边就增加一对说话者,放中间就增加两个说话者,所以f[i,j]:=(f[i-1,j-2]*(i-2)+f[i-1,j-1]<<1)mod 9937;


Problem: 3934  User: lydliyudong 
Memory: 924K  Time: 0MS 
Code Length: 299B
Language: Pascal  Result: Accepted 



var
 f:array[0..80,-1..157]of longint;
 n,m,i,j:longint;
begin
 f[1,0]:=1;
 for i:=2 to 80 do
  for j:=i-1 to i<<1-3 do
   f[i,j]:=(f[i-1,j-2]*(i-2)+f[i-1,j-1]<<1)mod 9937;
 read(n,m);
 while n+m<>0 do
  begin
   if m>157 then writeln(0) else writeln(f[n,m]);
   read(n,m);
  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