Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- using namespace std;
- long long a, b, c, av, av1, max1, max2;
- int main()
- {
- cin >> a;
- for(int i = 0; i < a; i++)
- {
- av1 = av;
- cin >> b >> c;
- av -= b;
- av += c;
- max1 = max(av1, av);
- max2 = max(max1, max2);
- }
- cout << max2;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement