-
Notifications
You must be signed in to change notification settings - Fork 95
Expand file tree
/
Copy path6.2.cpp
More file actions
41 lines (37 loc) · 819 Bytes
/
6.2.cpp
File metadata and controls
41 lines (37 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
* 题目名称:又一版 A+B
* 题目来源:浙江大学复试上机题
* 题目链接:http://t.cn/AiCuOSWv
* 代码作者:杨泽邦(炉灰)
*/
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
void Convert(long long n, int x) { //10进制转换成为x进制
vector<int> answer;
if (n == 0) {
answer.push_back(0);
} else {
while (n != 0) {
answer.push_back(n % x);
n /= x;
}
}
for (int i = answer.size() - 1; i >= 0; --i) {
printf("%d", answer[i]);
}
printf("\n");
}
int main() {
int m;
while (scanf("%d", &m) != EOF) {
if (m == 0) {
break;
}
long long a, b;
scanf("%lld%lld", &a, &b);
Convert(a + b, m);
}
return 0;
}