ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1036. Lucky Tickets

Tang RZ I cannot get AC! [3] // Problem 1036. Lucky Tickets 4 Jun 2004 18:39
This is my program:
var
  t,total,k:longint;
  n,s:integer;

procedure init;
begin
  read(n,s);
  total:=0;
  k:=0;
end;

procedure work;
var
  i:integer;
begin
  for i:=9 downto 0 do
    if (total+i<=s div 2)and(k<=n) then
      begin
        inc(k);
        total:=total+i;
        if (total=s div 2)and(k=n) then inc(t)
          else work;
        total:=total-i;
        dec(k);
      end;
end;

procedure print;
begin
  writeln(t*t);
end;

begin
  init;
  work;
  print;
end.
marina_ufa Use long arithmetic... :) [1] // Problem 1036. Lucky Tickets 5 Jun 2004 14:41
Tang RZ Re: Use long arithmetic... :) // Problem 1036. Lucky Tickets 12 Jun 2004 18:43
What did you mean? I cannot get it! My English is poor!