Knapsack problem/Continuous: Difference between revisions
Content added Content deleted
(→{{header|Pascal}}: simplified version) |
m (→{{header|Pascal}}: cosmetic) |
||
Line 2,656: | Line 2,656: | ||
Items[I].Weight := Min(Items[I].Weight, MaxWeight); |
Items[I].Weight := Min(Items[I].Weight, MaxWeight); |
||
MaxWeight := MaxWeight - Items[I].Weight; |
MaxWeight := MaxWeight - Items[I].Weight; |
||
WriteLn( |
WriteLn(Format('%-8s %.1f kg', [Items[I].Name, Items[I].Weight])); |
||
Inc(I); |
Inc(I); |
||
until (MaxWeight <= 0)or(I = Length(Items)); |
until (MaxWeight <= 0)or(I = Length(Items)); |