Guest User

491D-2

a guest
Jun 23rd, 2018
1,044
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     string s[2];
  7.  
  8.     int n = 2;
  9.     int m;
  10.     for (int i = 0; i < n; i++) {
  11.         cin >> s[i];
  12.         m = s[i].length();
  13.     }
  14.     n = m;
  15.  
  16.     int ans = 0;
  17.     int empty = 0;
  18.     for (int i = 0; i < n; i++) {
  19.         int current = (s[0][i] == '0') + (s[1][i] == '0');
  20.         empty += current;
  21.         if (empty >= 3) {
  22.             empty -= 3;
  23.             ans++;
  24.         }
  25.         else
  26.             empty = current;
  27.     }
  28.  
  29.     cout << ans;
  30. }
RAW Paste Data