4 solutions

  • 0
    @ 2026-8-28 10:17:29
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int n,x;
        cin>>n>>x;
        string s;
        while(n)
        {
            int g=n%x;
            if(g<10) s=s+char(g+'0');
            else s=s+char('A'+g-10);
            n/=x;
        }
        reverse(c++s.begin(),s.end());
        cout<<s;
        return 0;
    }
    
    

    Information

    ID
    2851
    Time
    1000ms
    Memory
    64MiB
    Difficulty
    1
    Tags
    # Submissions
    52
    Accepted
    20
    Uploaded By