题目
团体程序设计天梯赛
题解
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int is_num(string x){
if(x[0]=='0')return 0;
int sum = 0;
for(auto c:x){
if('0'<=c&&c<='9'){
sum = sum*10 + c-'0';
}else return 0;
}
if(1<=sum&&sum<=1000){
return sum;
}else return 0;
}
int main()
{
int sum = 0;
string A,B;
cin >> A;
getchar();
getline(cin,B);
int a = is_num(A);
int b = is_num(B);
if(a)cout << a;
else cout << "?";
cout << " + ";
if(b)cout << b;
else cout << "?";
cout << " = ";
if(a&&b)cout << a+b;
else cout << "?";
return 0;
}