{$B-} PROGRAM CKNAPSAC (INPUT,OUTPUT); {} { } { w } { } { u t F v | v } { } { w F \ q } { } { w F Q O r r P P T R } { } { w F C w } { } { w w F w w } { } { F } { } { g p F o } { } { F P X W T N X } { } {} CONST NN=100; TYPE CARGO=ARRAY[1..NN] OF INTEGER; MARK=ARRAY[1..NN] OF BOOLEAN; VAR N,C,K : INTEGER; S : CARGO; SETT : MARK; I,J : INTEGER; MAXSUM : INTEGER; { EXTERNAL PROCEDURE KNAPSAC (N,C,K : INTEGER; VAR S : CARGO; VAR SETT : MARK; VAR MAXSUM : INTEGER); } {$I B:KNAPSAC.SRC} BEGIN READLN (N,C,K); FOR I:=1 TO N DO READ(S[I]); WRITELN(LST); WRITELN(LST,'-------------------------------------'); KNAPSAC(N,C,K,S,SETT,MAXSUM); FOR I:=1 TO N DO IF SETT[I] THEN WRITE(LST,S[I] :8); WRITELN(LST); WRITELN(LST,'MAXSUM=',MAXSUM) END.