提交时间:2023-08-21 19:13:51

运行 ID: 99068

#include<iostream> #include<deque> using namespace std; int main() { int k, n, l; while (cin >> k >> n >> l) { int s{}, i{ n }; deque<int>v; do v.push_front(n % 10); while (n /= 10); for (auto x : v) s = s * k + x; v.clear(); do v.push_front(s % l); while (s /= l); for (auto x : v) if (x > 9) cout << char(x - 10 + 'A'); else cout << x; cout << endl; } return 0; }