Tuesday, January 21, 2020

Codeforces 116A Tram Solution in C++



  1. ///SMS
  2. #include <iostream>
  3. using namespace std;
  4. int main ()
  5. {
  6. int i,j,a,b,x=0,y=0,n,s=0;
  7. cin>>n;
  8. for (i=0;i<n;i++)
  9. {
  10. cin>>a>>b;
  11. x-=a;
  12. x+=b;
  13. if (x>s) s=x;
  14. }
  15. cout<<s<<endl;
  16. return 0;
  17. }

No comments:

Post a Comment

Codeforces 131A cAPS lOCK Solution in C

#include <stdio.h> int main () { char ch [ 106 ]; int i , j , ck = 1 ; scanf ( "%s" , ch ); ...