慕仙森
using namespace std; int to10bit(int x, int B){ int bit; int res = 0, k = 1; while( x != 0 ){ bit = x%10; res += bit*k; k *= B; x /= 10; } return res;} int main(){ int x, y, z; while( cin >> x >> y >> z ) { int p, q, r; int B; for(B = 2; B <= 40; ++B){ p = to10bit(x, B); q = to10bit(y, B); r = to10bit(z, B); if( p*q == r ){ cout << B << endl; break; } } if( B > 40 ){ cout << "0" << endl; } } return 0;}