HDU-1877(有一版 A+B)

题目链接:https://vjudge.net/problem/HDU-1877
#include 
#include 

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;
}

你可能感兴趣的:(进制)