社区讨论
90分求调,必回关
B2141确定进制参与者 3已保存回复 3
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 3 条
- 当前快照
- 1 份
- 快照标识符
- @m605s15i
- 此快照首次捕获于
- 2025/01/17 10:46 去年
- 此快照最后确认于
- 2025/11/04 11:28 4 个月前
CPP
#include<bits/stdc++.h>
using namespace std;
int p,q,r,maxj=-1;
int jz(int j,int num){
int ans=0,t=0;
while(num!=0){
ans+=(num%10)*pow(j,t);
// cout<<num<<endl;
t++;
num/=10;
}
return ans;
}
void tst(int x){
int ans=0;
while(x!=0){
ans=x%10;
if(ans>maxj){
maxj=ans;
}
x/=10;
}
}
int main()
{
cin>>p>>q>>r;
tst(p);tst(q);tst(r);
// cout<<maxj;
// jz(13,r);
for(int i=2;i<=16;i++){
int a,b,c;
// for(int j=2;j<)
// cout<<i<<endl;
a = jz(i,p);
b = jz(i,q);
c = jz(i,r);
// cout<<i<<" "<<a<<" "<<q<<" "<<r<<endl;
if(a*b==c&&maxj<i){
cout<<i;
// cout<<a<<" "<<b<<" "<<c;
return 0;
}
}
// cout<<maxj;
cout<<0;
return 0;
}
回复
共 3 条回复,欢迎继续交流。
正在加载回复...