Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- #include <cstdlib>
- #include <algorithm>
- #include <cmath>
- #include <iomanip>
- #include <numeric>
- #include <vector>
- using namespace std;
- #define ll long long
- void sherry()
- {
- ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
- #endif
- }
- int main()
- {
- sherry();
- ll n;
- cin >> n;
- ll arr[2]{};
- string s;
- cin >> s;
- for (ll i = 0; i < n; i++)
- {
- arr[s[i] - '0']++;
- }
- ll ones;
- arr[1] % 2 == 0 ? ones = (arr[1] / 2) - 1 : ones = arr[1] / 2;
- if (arr[1] > 0)
- cout << "1";
- for (ll i = 0; i < arr[0]; i++)
- {
- cout << "0";
- }
- for (ll i = 0; i < ones; i++)
- {
- cout << "1";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement