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 temp41 at 2004-10-27 19:54:44 on Problem 1664
In Reply To:请问:怎么递归啊? Posted by:c0400330001 at 2004-05-29 22:21:00
Program p1664(Input,Output);
 var i,j,t,n,m:integer;
     k:longint;
 Procedure digui(pi,i,ki:shortint);
  var j:integer;
   begin
   if ki<pi then exit;
   if (i=1) and (ki>=pi) then begin inc(k); exit; end;
   for j:=pi to ((ki+3) div i) do digui(j,i-1,ki-j);
   end;

  Begin
   readln(t);
   for i:=1 to t do
    begin
     k:=0;
     readln(m,n);
     if n<>0 then digui(0,n,m);
     writeln(k);
    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