问题标题: 酷町堂:2798 连接字符串1

0
0
被禁言 杜明泽
杜明泽
资深守护
资深守护

#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm> 
using namespace std;
int main(){
string a,b;
cin>>a>>b;
if((a[a.size()-1]-'0'+b[b.size()-1]-'0')%10<=4){
for(int i=a.length()-1;i>=0;i--){
cout<<a[i]; 
}
cout<<endl;
for(int i=b.length()-1;i>=0;i--){
cout<<b[i]; 
}
}
else{
cout<<b+a;
}
return 0;
}


0
0
0
0
高乐彤
高乐彤
新手天翼
新手天翼

输出的数字开头也不能是0!

教你个函数解决输出的数字开头也不能是0的问题:

void ans(string &s){
    while(s[0]=='0'){
        s.erase(0,1);
    }
    return ;
}

记得ctrl+p!

0
李锦昊
李锦昊
中级天翼
中级天翼

逆向输出的数字开头也不能是0

0
0
0
我要回答