Advertisement
dllbridge

Untitled

Nov 24th, 2022
781
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. long long a, b, c, av, av1, max1, max2;
  6.  
  7. int main()
  8. {
  9.      cin >> a;
  10.      
  11.      for(int i = 0; i < a; i++)
  12.      {
  13.          av1 = av;
  14.          cin >> b >> c;
  15.          av -= b;
  16.          av += c;
  17.          max1 = max(av1, av);
  18.          max2 = max(max1, max2);
  19.      }
  20.      
  21.      cout << max2;
  22.      
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement