Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
99082 柯昊阳 确定进制 C++ 通过 100 0 MS 272 KB 1007 2023-08-21 22:40:55

Tests(4/4):


#include <bits/stdc++.h> using namespace std; int main(){ int n,m,k; cin>>n>>m>>k; int max = 0; int tn = n,tm = m,tk = k; while(tn>0){ if(tn%10>max) max = tn%10; tn = tn/10; } while(tm>0){ if(tm%10>max) max = tm%10; tm = tm/10; } while(tk>0){ if(tk%10>max) max = tk%10; tk = tk/10; } for(int i = max+1;i<=16;i++){ tn = n,tm = m,tk = k; int a = 0,b = 0,c = 0; int d = 0; while(tn>0){ a += pow(i,d)*(tn%10); d++; tn = tn/10; } d = 0; while(tm>0){ b += pow(i,d)*(tm%10); d++; tm = tm/10; } d = 0; while(tk>0){ c += pow(i,d)*(tk%10); d++; tk = tk/10; } if(a*b==c) { cout<<i<<endl; return 0; } } cout<<"0"<<endl; return 0; }


测评信息: