竞赛
考级
超简单
#include<bits/stdc++.h> using namespace std; int n; string b; int main(){ int t; cin>>t; while(t--){ cin>>n>>b; string s="1"; for(int i=1;i<n;i++){ if(b[i]+1!=s[i-1]+b[i-1]-'0'){ s+="1"; }else{ s+="0"; } } cout<<s<<"\n"; } return 0; }
提交答案之后,这里将显示提交结果~