题解 | #又一版 A+B#

又一版 A+B

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

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

#define N 1000000
void change(int m,long long n){
	int a[N]={0},i=0;
    if (n==0) cout <<n;
	while (n){
		a[i++] = n%m;
		n/=m;
	}
	for (int j = i-1;j>=0;j--)cout <<a[j];
    cout<<endl;
}
int main(){
	int m;
    long long a,b;
	while (cin >>m>>a >>b && m != 0){
        int c[N],i,j;
        long long val = a+b;
		change(m,val);
	}
}

全部评论

相关推荐

鬼迹人途:你去投一投尚游游戏,服务器一面,第一个图算法,做完了给你一个策略题,你给出方案他就提出低概率问题,答不上当场给你挂
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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