fork download
  1. program ideone;
  2. var
  3. x, y, z, s: double;
  4. p: ^double;
  5. begin
  6. readln(x, y, z);
  7.  
  8. s := x + y + z;
  9.  
  10. if x < y then p := @x else p := @y;
  11. if (s < 1) and (z < p^) then p := @z;
  12.  
  13. p^ := (s - p^) / 2;
  14.  
  15. writeln(x:7:4, y:7:4, z:7:4);
  16. end.
Success #stdin #stdout 0s 336KB
stdin
0.5 0.25 0.125
4 2 1
stdout
 0.5000 0.2500 0.3750