Advertisement
Varvara_Golovnova

Untitled

Sep 15th, 2024
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. var
  2. a : array [1..1000] of longint;
  3. n,sum1,i,sum2,max : longint;
  4. begin
  5. readln(n);
  6. for i:=1 to n do
  7. readln(a[i]);
  8. sum1:=0;
  9. for i:=1 to n do
  10. sum1:=sum1+a[i];
  11. for i:=1 to n do
  12. max:=a[1];
  13. sum2:=0;
  14. for i:=1 to n do
  15. if a[i]>max then
  16. max:=a[i];
  17. sum2:=max+max;
  18. writeln(sum2,' (',sum1,')');
  19. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement