90分(g
查看原帖
90分(g
765954
c______楼主2023/9/3 23:21

本人蒟蒻一枚,求救

验证码是h648哎

只有可怜的90分

以下是代码:

#include<iostream>
using namespace std;
int maxnum(int a,int b,int c){
	int maxx=a>b?a:b;
	maxx=maxx>c?maxx:c;
	maxx=maxx>2?maxx:2;
	return maxx;
}
int f(int n)
{
	int maxx=0;
	while(n)
	{
		if(n%10>maxx)
			maxx=n%10;
		n/=10;
	}
	return maxx;
}
int r10(int j,int s)
{
	int q=1,g,shi=0;
	while(s!=0)
	{
		g=s%10;
		shi=shi+g*q;
		q*=j;
		s/=10;
	}
	return shi;
}
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	int t = maxnum(f(a),f(b),f(c))+1;
	for(int i = t;i<=1000000;i++){
		if(r10(i,a)*r10(i,b)==r10(i,c)){
			cout<<i;
			return 0;
		}
	}
	cout<<0;
	return 0;
}
2023/9/3 23:21
加载中...