Submission

Status:
PPPPPPPPPP

Score: 100

User: Dormon

Problemset: Base Converter

Language: cpp

Time: 0.002 second

Submitted On: 2025-03-17 08:30:18

#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n, k;
    cin >> n >> k;

    auto base = [&](int n, int k) -> string {
        string res = "";
        while (n > 0){
            res += '0' + (n % k);
            n /= k;
        }
        reverse(res.begin(), res.end());
        return res;
    };

    cout << base(n, k) << '\n';
}