【Codeforces Round #455 (Div. 2) A】Generate Login

【链接】 我是链接,点我呀:)
【题意】

在这里输入题意

【题解】

枚举两个串的前缀长度就好。 组出来。 排序。 取字典序最小的那个。

【代码】

#include <bits/stdc++.h>
using namespace std;

string s1,s2;
vector <string> v;

int main(){
	#ifdef LOCAL_DEFINE
	    freopen("rush_in.txt", "r", stdin);
	#endif
	ios::sync_with_stdio(0),cin.tie(0);
    cin >> s1 >> s2;
    int l1 = s1.size(),l2 = s2.size();
    for (int i= 1;i <= l1;i++)
        for (int j = 1;j <= l2;j++){
            string s = s1.substr(0,i)+s2.substr(0,j);
            v.push_back(s);
        }
    sort(v.begin(),v.end());
    cout << v[0]<<endl;
	return 0;
}
原文地址:https://www.cnblogs.com/AWCXV/p/8134210.html