fork download
  1. program ideone;
  2. var
  3. x1,x2:integer;
  4. max: record
  5. x1,x2,value: integer;
  6. end;
  7. begin
  8. max.value := 0;
  9. for x1 := 60 downto 0 do
  10. for x2 := 80 downto 0 do
  11. if (15*x1 + 10*x2) <= 950 then
  12. if (40*x1 + 20*x2) > max.value then
  13. begin
  14. max.value := 40*x1 + 20*x2;
  15. max.x1 := x1;
  16. max.x2 := x2;
  17. end;
  18.  
  19. writeln(max.value, ' ', max.x1, ' ', max.x2);
  20. end.
Success #stdin #stdout 0s 280KB
stdin
Standard input is empty
stdout
2500 60 5