sotanishy's code snippets for competitive programming
10進数の整数 $n$ を $base$ 進数に変換する
vector<int> convert_base(int n, int base)
#pragma once
#include <vector>
std::vector<int> convert_base(int n, int base) {
int q = n / base, r = n % base;
if (q == 0) return {r};
auto ret = convert_base(q, base);
ret.push_back(r);
return ret;
}
#line 2 "math/convert_base.cpp"
#include <vector>
std::vector<int> convert_base(int n, int base) {
int q = n / base, r = n % base;
if (q == 0) return {r};
auto ret = convert_base(q, base);
ret.push_back(r);
return ret;
}