Advertisement
rengetsu

Codeforces_556A

Jul 12th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. // Codeforces 556A
  2.  
  3. #include <cstring>
  4. #include <iostream>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     int n, nn, zer = 0, one = 0;
  11.     string str;
  12.     cin >> n >> str;
  13.     char mass[n];
  14.     strcpy(mass, str.c_str());
  15.     for( int i = 0; i < n; i++ )
  16.     {
  17.         if( mass[i] == '1' ){one++;}
  18.         else{zer++;}
  19.     }
  20.     if( one > zer ){cout<<one-zer;}
  21.     else{cout<<zer-one;}
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement