Advertisement
karlicoss

23.10.07

Sep 1st, 2011
494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.66 KB | None | 0 0
  1. program o;
  2. {$APPTYPE CONSOLE}
  3. var a1,a2,a3,b1,b2,b3,m,k:integer;
  4. a,b:array [1..3] of integer;
  5. begin
  6. assign(input,'input.txt');
  7. reset(input);
  8. assign(output,'output.txt');
  9. rewrite(output);
  10. read(a1,a2,a3,b1,b2,b3);
  11. a[1]:=a1;
  12. a[2]:=a2;
  13. a[3]:=a3;
  14. b[1]:=b1;
  15. b[2]:=b2;
  16. b[3]:=b3;
  17. m:=1;
  18. if a[2] > a[m] then m:=2;
  19. if a[3] > a[m] then m:=3;
  20. k:=a[1];
  21. a[1]:=a[m];
  22. a[m]:=k;
  23. if a[3] > a[2] then
  24. begin
  25. k:=a[2];
  26. a[2]:=a[3];
  27. a[3]:=k;
  28. end;
  29. m:=1;
  30. if b[2] > b[m] then m:=2;
  31. if b[3] > b[m] then m:=3;
  32. k:=b[1];
  33. b[1]:=b[m];
  34. b[m]:=k;
  35. if b[3] > b[2] then
  36. begin
  37. k:=b[2];
  38. b[2]:=b[3];
  39. b[3]:=k;
  40. end;
  41. write((a[1]*b[1])+(a[2]*b[2])+(a[3]*b[3]));
  42. close(output);
  43. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement