我可是首评+100%正确率!!
2026-04-28 12:10:51
发布于:江苏
7阅读
0回复
0点赞
懂得都懂学了三级什么什么密码的都会,所以我废话使劲说,直接上代码答案!!
#include <iostream>
using namespace std;
int main(){
string s;
int n, max=-1;/*<-这不能是其它数*/
char c;
cin >> n >> s >> c;
for(int i = 0;i < n; i++){
if(s[i]>=c){
cout<<s[i];
}else{
max = i;
cout<< c;
break;
}
}
if(max != -1){
while( max < n ){
cout << s [ max ];
max++;
}
}else{
cout<< c;
}
return 0;
}
这里空空如也







有帮助,赞一个