#include <stdio.h> #include <iostream> #include <algorithm> #include <string> #include <vector> #include <math.h> using namespace std; int N; long long NUM; string ans; string rule = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; void change(long long num) { while(num != 0) { int temp = num % N; num /= N; ans = rule[temp] + ans; } } int main(void) { // freopen("B11005_input.txt", "r", stdin); cin >> NUM >> N; change(NUM); cout << ans; return 0; } | cs |
'Baekjoon > Math' 카테고리의 다른 글
[백준 1212] 8진수 2진수 (Math) (C/C++) (0) | 2020.01.24 |
---|---|
[백준 1373] 2진수 8진수 (Math) (C/C++) (0) | 2020.01.24 |
[백준 2745] 진법 변환 (Math) (C/C++) (0) | 2020.01.24 |
[백준 9613] GCD 합 (Math) (C/C++) (0) | 2020.01.24 |
[백준 2609] 최대공약수와 최소공배수 (Math) (C/C++) (0) | 2020.01.24 |