92分,求条!!!
查看原帖
92分,求条!!!
1448418
yeyan_zhou楼主2025/8/4 08:56

WA点 代码

#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    string a,c,b="";
    cin>>a>>c;
    for(int i=0;i<a.size();i++){
        if(a[i]==c[i]){
            if(a[i]=='z'){
                cout<<-1;
                return 0;
            }
            else b+=(char)a[i]+1;
        }
        else{
            if(c[i]>a[i]){
                cout<<-1;
                return 0;
            }
            b+=c[i];
        }
    }
    cout<<b;
    return 0;
}
2025/8/4 08:56
加载中...