티스토리 뷰

#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
{
    int n, b;
    scanf("%d %d", &n, &b);

    int rest;
    string result = "";
    while (n > 0)
    {
        rest = n % b;
        n = n / b;

        if (rest < 10)
        {
            result = to_string(rest) + result;
        }
        else
        {
            result = (char)('A' + rest - 10) + result;
        }
    }

    cout << result << endl;
}
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/06   »
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
글 보관함