Advertisement
Saleh127

CF 1037C

Oct 4th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);cout.tie(0);
  9.  
  10. string a,c;
  11. ll d,e=0,f,i,j,k,l;
  12. cin>>d>>a>>c;
  13. for(i=0;i<d;i++)
  14. {
  15. if(a[i]!=c[i] && a[i+1]!=c[i+1])
  16. {
  17. e++;
  18. swap(a[i],a[i+1]);
  19. }
  20. else if(a[i]!=c[i])
  21. {
  22. e++;
  23. if(a[i]=='0') a[i]='1';
  24. else a[i]='0';
  25. }
  26. }
  27. cout<<e<<endl;
  28.  
  29. return 0;
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement