Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
99128 陈志轩 确定进制 C++ 通过 100 0 MS 264 KB 1143 2023-08-22 09:05:17

Tests(4/4):


#include<bits/stdc++.h> #define int long long using namespace std; namespace Fast{ inline int fr(){ register int x = 0,f = 1; static char c = getchar(); while (c < '0' || c > '9'){ if (c == '-'){ f = -1; } c = getchar(); } while (c >= '0' && c <= '9'){ x = (x << 1) + (x << 3) + (c ^ 48); c = getchar(); } return x * f; } inline void fw(int x){ if (x < 0){ x = -x; putchar('-'); } if (x > 9){ fw(x / 10); } putchar(x % 10 + 48); } } using namespace Fast; inline int change(int a,int i){ int sum = 0,o = 0; while (a){ sum += (a % 10) * pow(i,o); o++; a /= 10; } return sum; } signed main(){ int p,q,r,pp,qq,rr,a = 0; p = fr(),q = fr(),r = fr(); pp = p,qq = q,rr = r; while (pp){ a = max(a,pp % 10); pp /= 10; } while (qq){ a = max(a,qq % 10); qq /= 10; } while (rr){ a = max(a,rr % 10); rr /= 10; } int P,Q,R; for (int i = max(a + 1,2LL);i <= 16;i++){ P = change(p,i); Q = change(q,i); R = change(r,i); if (P * Q == R){ fw(i); return 0; } } puts("0"); return 0; }


测评信息: