题解 | #又一版 A+B#

又一版 A+B

https://www.nowcoder.com/practice/9255c05d45b8406c9b588d7c57aa920b

#include <iostream>
#include <algorithm>
using namespace std;



int main() {
    long long a, b, c;
    int m;
    while (cin >> m && m != 0) {
        cin >> a >> b;
        c = a + b;
        string res = "";
        
        do {
            res += c % m + '0';
            c = c / m;
        } while (c != 0);
        reverse(res.begin(), res.end());
        cout << res << endl;
    }
    return 0;
}

全部评论

相关推荐

02-17 20:43
西北大学 Java
点赞 评论 收藏
分享
Java抽象带篮子:可以看看我的置顶帖子,里面写了技术栈怎么描述
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务