-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path696A.cpp
More file actions
39 lines (36 loc) · 716 Bytes
/
Copy path696A.cpp
File metadata and controls
39 lines (36 loc) · 716 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
scanf("%d", &t);
while (t--)
{
int n;
scanf("%d", &n);
string s,ans;
cin >> s;
if(s[0]=='1'){
ans.push_back('2');
}
else
{
ans.push_back('1');
}
for (int i = 1; i < s.size(); i++)
{
if(s[i]+1==ans[i-1]){
ans.push_back(s[i]);
}
else
{
ans.push_back(s[i]+1);
}
}
for (int i = 0; i <ans.size(); i++)
{
printf("%c",ans[i]-s[i]+48);
}
printf("\n");
}
}