提交时间:2023-08-21 16:22:57
运行 ID: 99028
#include<iostream> #include<cmath> #define in long long using namespace std; in p, q, r; in change(in a, in base){ in res=0, i=0; while(a){ res+=(a%10)*(in)(pow(base,i)); ++i; a/=10; } return res; } in pos(in a){ in res=0; while(a){ res=max(res,a%10); a/=10; if(res==9) break; } return res; } int main(){ cin>>p>>q>>r; in t=max({pos(p),pos(q),pos(r)}); for(in i=t+1;i<=62;i++) if(change(p,i)*change(q,i)==change(r,i)) return cout<<i,0; puts("0"); return 0; }