Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # https://www.spoj.com/PTIT/users/hoaf13
- # STAND BY PAXD
- #include<bits/stdc++.h>
- using namespace std;
- void process(){
- string s;
- cin >> s;
- string res = "";
- res += s[0];
- for(int i=1;i<s.length();i++){
- char tmp = ((s[i]-'0') + (s[i-1]-'0')) + '0';
- if (tmp == '2') tmp = '0';
- res += tmp;
- }
- cout << res << endl;
- }
- int main(){
- int T;
- cin >> T;
- while(T--) process();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement