2 solutions

  • 0
    @ 2023-2-11 15:33:47
    #include<bits/stdc++.h>
    using namespace std;
    int i[1000000];
    int a1,b1,q;
    
    void solve(int a,int b){
    	q=0;
    	while(a>b){
    		i[q]=a%b;
    		q++;
    		a-=a%b;
    		a/=b;
    	}
    	i[q]=a;
    }
    
    int main()
    {
    	cin>>a1>>b1;
    	solve(a1,b1);
    	for(int c=q;c>=0;c--){
    		if(i[c]>=10){
    			char b='A'+i[c]-10;
    			cout<<b;
    		}else{
    			cout<<i[c];
    		}
    	}
    }
    

    Information

    ID
    6691
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    4
    Tags
    (None)
    # Submissions
    27
    Accepted
    16
    Uploaded By