题解 | #又一版 A+B#

又一版 A+B

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

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

int main() {
    int base;
    while(cin>>base && base!=0){
        long long a,b;
        cin>>a>>b;
        long long n=a+b;
        if(n==0) {
            cout<<0<<endl;
            continue;}
        vector<int> ar;
        while(n>0){
            ar.push_back(n%base);
            n/=base;
        }
        for(int i=ar.size()-1;i>=0;i--) cout<<ar[i];
        cout<<endl;
    }
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

_mos_:要不是看评论区我都不知道你要找的是数分
点赞 评论 收藏
分享
11-11 16:40
已编辑
门头沟学院 人工智能
不知道怎么取名字_:这个有点不合理了,相当于已经毕业了,但还是没转正,这不就是白嫖
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务