且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

A. Case of the Zeros and Ones

更新时间:2022-08-13 08:45:14

题目链接:http://codeforces.com/contest/556/problem/A

#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
    int m;
    string s;
    cin>>m>>s;
    int j=0;
    for(int i=0; i<m; i++)
    {
        if(s[i]=='0')
            j++;
    }
    cout<<abs(m-2*j);
    return 0;
}