3 条题解

  • 0
    @ 2026-11-15 11:41:40

    #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; }

    信息

    ID
    68
    时间
    1000ms
    内存
    128MiB
    难度
    1
    标签
    递交数
    75
    已通过
    63
    上传者