1 条题解

  • 1
    @ 2026-1-19 11:54:47
    #include<bits/stdc++.h>
    using namespace std;
    long long p,q,r;
    long long change(long long a,long long base){
    	long long res=0, i=0;
    	while(a){
    		res+=(a%10)*(int)(pow(base,i));
    		++i;
    		a/=10;
    	}
    	return res;
    }
    long long pos(long long a){
    	long long res=0;
    	while(a){
    		res=max(res,a%10);
    		a/=10;
    		if(res==9) break;
    	}
    	return res;
    }
    int main(){
    	cin>>p>>q>>r;
    	int t=max({pos(p),pos(q),pos(r)});//C++98没有这种写法
    	for(long long i=t+1;i<=62;i++)
    		if(change(p,i)*change(q,i)==change(r,i))
    			return cout<<i,0;
    	cout<<0;
    	return 0;
    }
    
    • 1

    信息

    ID
    6998
    时间
    1000ms
    内存
    128MiB
    难度
    3
    标签
    递交数
    5
    已通过
    3
    上传者