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