1 solutions

  • 0
    @ 2025-4-24 15:40:43
    #include<bits/stdc++.h>
    using namespace std;
    void  f(int d)
    {
    	if(d>=10) cout<<char('A'+d-10);
    	else cout<<char('0'+d);
    }
    void shuchu(int s)
    {
    	f(s>>4);//输出高四位
    	f(s&0x0f);//输出低四位 
    }
    int main()
    {
    	long long n;
    	cin>>n;
    	int a[10]={};
    	int cnt=0;
    	while(n>0)
    	{
    		a[cnt]=int(n&0x7f);//保留后7位 
    		n=n>>7; //删除7位
    		cnt++; 
    	}
    	cnt--;//最后一次不需要增加 
    	for(int i=0;i<cnt;i++)
    	{
    		a[i]|=0x80;//除开最后一个,其它的补1 
    	}
    	shuchu(a[0]);
    	for(int i=1;i<=cnt;i++)
    	{
    		cout<<" ";
    		shuchu(a[i]);
    	}
    	return 0;
    }
    
    • 1

    Information

    ID
    2525
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    7
    Tags
    (None)
    # Submissions
    2
    Accepted
    1
    Uploaded By