#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,s1,s2;
//s1代表最大与a+b相差的值,s2代表最小与a+香肠的值
cin>>a>>b;//输入a和b
for(int s=1,x=a;x;x/=10,s*=10)
//s记录在哪一位是5或6,s每次都乘10
if(x%10==5)s1+=s;//核心代码
else if(x%10==6)s2+=s;
for(int s=1,y=b;y;y/=10,s*=10)//同上
if(y%10==5)s1+=s;
else if(y%10==6)s2+=s;
cout<<a+b-s2<<" "<<a+b+s1;//输出最小和最大
return 0;//结束程序
}
洛谷-类高精度替换
猜你喜欢
转载自blog.csdn.net/weixin_52045928/article/details/116430946
今日推荐
周排行