题解 | #又一版 A+B#
又一版 A+B
https://www.nowcoder.com/practice/9255c05d45b8406c9b588d7c57aa920b
#include <iostream> #include "stack" using namespace std; int main() { int m; while (cin >> m) { if (m == 0) break; long long a, b; cin >> a >> b; long long sum = a + b; stack<int> nums; if(sum==0) nums.push(0); while (sum >0) { nums.push(sum % m); sum = sum / m; } while (!nums.empty()) { cout << nums.top(); nums.pop(); } cout << endl; } } // 64 位输出请用 printf("%lld")