当前位置: 代码迷 >> 综合 >> HDU-1877(有一版 A+B)
  详细解决方案

HDU-1877(有一版 A+B)

热度:86   发布时间:2023-11-23 12:57:17.0
题目链接:https://vjudge.net/problem/HDU-1877
#include <iostream>
#include <cstdio>using namespace std;typedef unsigned int ui;void DecToAny(ui n, int t)
{if(n == 0) return;DecToAny(n/t, t);printf("%d", n%t);
}
int main()
{int m;ui a, b;while(scanf("%d", &m) != EOF && m){scanf("%d%d", &a, &b);if(a + b == 0) cout << 0;else DecToAny(a+b, m);cout << endl;}return 0;
}