#include <vector>
#include <string>
#include <iostream>
class Variable
{
private:
std::vector<char> mValue; // 紀錄,例如 mValue = 1?2??
int mMaxN; // 有多少種變化型
public:
void Set(std::string v)
{
mMaxN = 1;
for (unsigned i = 0; i < v.size() ; ++i)
{
if (v[i] >= '0' && v[i] <= '9')
{
mValue.push_back(v[i]);
}
else
{
mValue.push_back('?');
mMaxN *= 10;
}
}
}
unsigned GetMaxN()const // 有多少種變化型[0 ~ N-1]
{
return mMaxN;
}
unsigned GetValue(unsigned Nth)const //獲得第 N 大的資料
{
unsigned res = 0;
unsigned pow = 1;
for (int i = mValue.size() - 1; i >= 0; --i)
{
if (mValue[i] == '?')
{
res += (Nth % 10) * pow;
Nth /= 10;
}
else
{
res += (mValue[i] - '0') * pow;
}
pow *= 10;
}
return res;
}
};
int main()
{
Variable vX, vY, vZ;
std::string strX, strY, strZ;
std::cin >> strX >> strY >> strZ;
vX.Set(strX);
vY.Set(strY);
vZ.Set(strZ);
for (unsigned xx = 0; xx < vX.GetMaxN(); ++xx)
{
for (unsigned yy = 0; yy < vY.GetMaxN(); ++yy)
{
for (unsigned zz = 0; zz < vZ.GetMaxN(); ++zz)
{
if (vX.GetValue(xx)*vY.GetValue(yy) == vZ.GetValue(zz))
{
std::cout << vX.GetValue(xx) << "x" << vY.GetValue(yy) << "=" << vZ.GetValue(zz) << std::endl;
}
}
}
}
system("Pause");
return 0;
}
I2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPGlvc3RyZWFtPgpjbGFzcyBWYXJpYWJsZQp7CnByaXZhdGU6CglzdGQ6OnZlY3RvcjxjaGFyPiBtVmFsdWU7CS8vIOe0gOmMhO+8jOS+i+WmgiBtVmFsdWUgPSAxPzI/PwoJaW50IG1NYXhOOwkJCQkJLy8g5pyJ5aSa5bCR56iu6K6K5YyW5Z6LCnB1YmxpYzoKCXZvaWQgU2V0KHN0ZDo6c3RyaW5nIHYpIAoJewoJCW1NYXhOID0gM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