crowulll

Untitled

Aug 18th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. #include<iostream>
  2. #include<vector>
  3. using namespace std;
  4. int n;
  5. int main(){
  6.     cin >> n;
  7.     int m = -1; int sum = 0;
  8.     while (n--){
  9.         int x; cin >> x;
  10.         m = max(m, x);
  11.         sum += x;
  12.     }
  13.     cout << m - (sum - m) + 1;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment