Advertisement
jeff69

Untitled

Feb 25th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1.  
  2.  
  3. #include <iomanip>
  4. #include <iostream>
  5. #include <functional>
  6. #include <algorithm>
  7. #include <math.h>
  8. #include <cmath>
  9. #include <string>
  10.  
  11. using namespace std;
  12.  
  13. int main(){
  14. int n;
  15. int s = 0, z, x, v = 0;
  16. cin >> n;
  17. for (int i = 0; i < n; i++){
  18. cin >> x >> z;
  19. s = s + z - x;
  20. if (s >v){
  21. v = s;
  22. }
  23. }
  24. cout << v;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement