1 条题解
-
0
#include <bits/stdc++.h> using namespace std; typedef long long LL; char st[110]; int n, m; int a[110], len; int main() { LL n, m; scanf("%lld%s%lld", &n, st+1, &m); LL s = 0; for(int i = 1; i <= strlen(st+1); i++) { s *= n; if(st[i] >= '0' && st[i] <= '9') s += st[i] - '0'; else s += st[i] - 'A' + 10; } len = 0; while(s != 0) { a[++len] = s % m; s /= m; } for(int i = len; i >= 1; i--) { if(a[i] >= 0 && a[i] <= 9) printf("%d", a[i]); else printf("%c", a[i] - 10 + 'A'); } return 0; }
- 1
信息
- ID
- 819
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 6
- 标签
- 递交数
- 231
- 已通过
- 79
- 上传者