Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Kittiponn

Problemset: Base Converter

Language: cpp

Time: 0.002 second

Submitted On: 2026-03-04 08:48:35

#include <bits/stdc++.h>
#define ll long long
#define sp << ' ' <<
#define nl << '\n' 
#define cnl cout << '\n'
using namespace std;
const int nx = 1e5+5;
const int INF = 1e9+5;
const int MOD = 1e9+7;



int main(){
    cin.tie(0)->sync_with_stdio(0);
    int n,m;
    cin >> n >>m;
    vector<int> ans;
    while(n != 0){
        int x = n/m;
        int z = n-x*m;
        ans.push_back(z);
        n /= m;
    }
    reverse(ans.begin(),ans.end());
    for(auto x : ans)cout << x;
}