Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. # https://www.spoj.com/PTIT/users/hoaf13
  2. # STAND BY PAXD
  3. #include<bits/stdc++.h>
  4.  
  5. using namespace std;
  6.  
  7. void process(){
  8.     string s;
  9.     cin >> s;
  10.     string res = "";
  11.     res += s[0];
  12.     for(int i=1;i<s.length();i++){
  13.         char tmp = ((s[i]-'0') + (s[i-1]-'0')) + '0';
  14.         if (tmp == '2') tmp = '0';
  15.         res += tmp;
  16.     }
  17.     cout << res << endl;
  18.  
  19. }
  20.  
  21. int main(){
  22.  
  23.     int T;
  24.     cin >> T;
  25.     while(T--) process();
  26.  
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement