2 条题解
- 
  3
C++ :
#include <iostream> #include <algorithm> #include <vector> #include <cstring> using namespace std; string dfs(string a,int &x){ vector<string> v; x++; while(a[x]=='0') v.push_back(dfs(a,x)); x++; sort(v.begin(),v.end()); string ans="0"; for(auto it:v) ans+=it; ans+="1"; return ans; } int main() { int t; cin>>t; while(t--){ string a,b; cin>>a>>b; a="0"+a+"1"; b="0"+b+"1"; int au=0,bu=0; if(dfs(a,au)==dfs(b,bu)){ cout<<"same"<<endl; }else{ cout<<"different"<<endl; } } return 0; } - 
  0
#include #include #include #include using namespace std;
string dfs(string a,int &x){ vector v; x++; while(a[x]=='0') v.push_back(dfs(a,x)); x++; sort(v.begin(),v.end()); string ans="0"; for(auto it:v) ans+=it; ans+="1"; return ans; }
int main() { int t; cin>>t; while(t--){ string a,b; cin>>a>>b; a="0"+a+"1"; b="0"+b+"1"; int au=0,bu=0; if(dfs(a,au)==dfs(b,bu)){ cout<<"same"<<endl; }else{ cout<<"different"<<endl; } } return 0; }
 
- 1
 
信息
- ID
 - 68
 - 时间
 - 1000ms
 - 内存
 - 128MiB
 - 难度
 - 1
 - 标签
 - 递交数
 - 59
 - 已通过
 - 50
 - 上传者