|
|
back to boardI 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 (+) дБидґйНиТ№ code ґЩа·иТдЛГи№Р бµиЕН§ case №ХйґЩ 2 12 µйН§дґй 21 Re: I got WA for this problem, I don't know why please help me and this is my code (+) try this case 2 12 the answer must be 21 why 21? I think it should be 22 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 22,I thing.(maybe my program thinks) > try this case > 2 12 > the answer must be 21 |
|
|