5 solutions

  • 3
    @ 2025-4-26 13:58:11
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n,x;
    	cin>>n>>x;
    	string s;
    	while(n)
    	{
    		int ge=n%x; //计算余数
    		if(ge<10) s=s+char('0'+ge); 
    		else s=s+char('A'+ge-10);
    		n/=x; //更新商 
    	}
    	reverse(s.begin(),s.end());
    	cout<<s;
    	return 0;
    }
    
    
    • @ 2026-8-27 11:16:28
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
      	int n,x;
      	cin>>n>>x;
      	string s;
      	while(n)
      	{
      		int ge=n%x; //计算余数
      		if(ge<10) s=s+char('0'+ge); 
      		else s=s+char('A'+ge-10);
      		n/=x; //更新商 
      	}
      	reverse(s.begin(),s.end());
      	cout<<s;
      	return 0;
      }
      
      
  • 1
    @ 2026-7-24 14:58:38
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n,x;
    	cin>>n>>x;
    	string s;
    	while(n)
    	{
    		int ge=n%x;
    		if(ge<10) s=s+char('0'+ge); 
    		else s=s+char('A'+ge-10);
    		n/=x;
    	}
    	reverse(s.begin(),s.end());
    	cout<<s;
    	return 0;
    }
    
    
    

    A0595A0595 请点👍请点👍 随手点👍,手有余香随手点👍,手有余香

    • 0
      @ 2026-8-27 11:17:08
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
      	int n,x;
      	cin>>n>>x;
      	string s;
      	while(n)
      	{
      		int ge=n%x; //计算余数
      		if(ge<10) s=s+char('0'+ge); 
      		else s=s+char('A'+ge-10);
      		n/=x; //更新商 
      	}
      	reverse(s.begin(),s.end());
      	cout<<s;
      	return 0;
      }
      
      
      
      • 0
        @ 2026-4-25 9:34:08

        #include<bits/stdc++.h> using namespace std; int main() { int n,x; cin>>n>>x; string s; while(n) { int ge=n%x; if(ge<10) s=s+char('0'+ge); else s=s+char('A'+ge-10); n/=x; } reverse(s.begin(),s.end()); cout<<s; return 0; }

        • 0
          @ 2026-4-1 9:31:52

          #include <bits/stdc++.h> using namespace std; int main() { int n,x; cin>>n>>x; string s; while(n) { int ge=n%x; if(ge<10) { s=s+char('0'+ge); } else { s=s+char('A'+ge-10); } n/=x; } reverse(s.begin(),s.end()); cout<<s; return 0; }

          • 1

          Information

          ID
          1195
          Time
          1000ms
          Memory
          256MiB
          Difficulty
          3
          Tags
          (None)
          # Submissions
          77
          Accepted
          31
          Uploaded By