Submission
Status:
PPPPPPPPPP
Score: 100
User: Nakornrat
Problemset: Base Converter
Language: cpp
Time: 0.002 second
Submitted On: 2025-03-23 00:11:22
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
void basecon(int n, int b, string &res){
if(n==0)return;
int digit = n%b;
res+=to_string(digit);
basecon(n/b, b, res);
}
int main()
{
ios::sync_with_stdio(false);cin.tie(0);
int n, b;cin>>n>>b;
string ans = "";
basecon(n, b, ans);
reverse(ans.begin(), ans.end());
cout<<ans;
}