1 solutions

  • 0
    @ 2025-3-3 16:24:08

    C++ :

    #include<iostream>
    #include<cstring>
    using namespace std;
    int a[32];
    int main()
    {
    	int n;
    	cin>>n;
    	memset(a,0,sizeof(a));
    	for (int i=0; n; i++)
    	{
    		a[i]=n%2;
    		n/=2;
    	}
    	for (int i=0; i<=15; i++)
    		{ int t=a[i]; a[i]=a[i+16]; a[i+16]=t; }
    	unsigned ans=0;
    	for (int i=31; i>=0; i--)
    	{
    		ans*=2;
    		ans+=a[i];
    	}
    	cout<<ans<<endl;
    	return 0;
    }
    
    • 1

    Information

    ID
    10006
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By