P1689,样例对了,也只有样例对了,为什么?
#include <bits/stdc++.h>
using namespace std;
int main() {
char x, y, z, a, b;
long long x2, y2, z2;
cin >> x >> a >> y >> b >> z;
if (x >= '0' && x <= '9')
x2 = x - '0';
if (y >= '0' && y <= '9')
y2 = y - '0';
if (z >= '0' && z <= '9')
z2 = z - '0';
if (x == '?') {
if (a == '+')
x2 = z2 - y2;
else
x2 = z2 + y2;
cout << x2 << endl;
}
if (y == '?') {
if (a == '+')
y2 = z2 - x2;
else
y2 = x2 - z2;
cout << y2 << endl;
}
if (z == '?') {
if (a == '+')
z2 = x2 + y2;
else
z2 = x2 - y2;
cout << z2 << endl;
}
return 0;
}