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 1091. Tmutarakan Exams

I got WA for this problem, I don't know why please help me and this is my code (+)
Posted by Badd 15 Jan 2002 20:54
var k,s : longint;
    count : longint;
    l     : longint;
    gen   : array[1..50,1..50] of integer;
    ngen  : array[1..50] of integer;
procedure gendat;
var loop,loop2  : longint;
 begin
      fillchar(gen,sizeof(gen),0);
      fillchar(ngen,sizeof(ngen),0);
      for loop:=2 to 50 do
          begin
               for loop2:=2 to loop do
                   if loop mod loop2=0 then
                      begin inc(ngen[loop]); gen[loop,ngen[loop]]:=loop2; end;
          end;
 end;
procedure process(level,now,dat : integer);
var loop  : integer;
    lll   : integer;
 begin
      if level>=k then
         begin
              inc(count);
              if count>=10000 then
                 begin writeln(10000); halt; end;
              exit;
         end;
      loop:=now;
      for lll:=1 to ngen[dat] do
      if gen[dat,lll]*(k-level)>s then break
      else
      while loop+gen[dat,lll]<=s do
            begin
                 inc(loop,gen[dat,lll]);
                 process(level+1,loop,dat);
            end;
 end;
begin
     count:=0;
     readln(k,s);
     gendat;
     for l:=2 to s do
         begin
              process(1,l,l);
         end;
     writeln(count);
end.
Re: I got WA for this problem, I don't know why please help me and this is my code (+)
Posted by MadPsyentist/Sam 17 Jan 2002 15:24
&#1076;&#1041;&#1080;&#1076;&#1169;&#1081;&#1053;&#1080;&#1058;&#8470; code &#1169;&#1065;&#1072;&#183;&#1080;&#1058;&#1076;&#1051;&#1043;&#1080;&#8470;&#1056; &#1073;&#181;&#1080;&#1045;&#1053;&#167; case &#8470;&#1061;&#1081;&#1169;&#1065;
2 12
&#181;&#1081;&#1053;&#167;&#1076;&#1169;&#1081; 21
Re: I got WA for this problem, I don't know why please help me and this is my code (+)
Posted by MadPsyentist/Sam 17 Jan 2002 15:25
try this case
2 12
the answer must be 21
why 21? I think it should be 22
Posted by Tomasz Klos 2 Feb 2002 23:52
Re: why 21? I think it should be 22
Posted by mon 3 Feb 2002 00:58
>

you may use (6, 12) twice in your solution
you're right thank you
Posted by Tomasz Klos 3 Feb 2002 01:09
22,I thing.(maybe my program thinks)
Posted by minkerui 20 Aug 2002 16:07
> try this case
> 2 12
> the answer must be 21