4 solutions

  • 1
    @ 2026-7-7 14:48:55
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int x;
    	cin>>x;
    	if(x<0)
    	{
    		x=-x;
    		cout<<1;
    	}
    	else
    	{
    		cout<<0;
    	}
    	bitset<32> a(x);
    	for(int i=30;i>=0;i--)
    	{
    		cout<<a[i];
    	}
    	return 0;
    }
    
    
    
    • 1
      @ 2024-11-3 9:29:56
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          int x;
          cin>>x;
          if(x<0)
          {
              x=-x;
              cout<<1;
          }
          else
          {
              cout<<0;
          }
          for(int i=30;i>=0;i--)
          {
              if(x>>i&1)
              {
                  cout<<1;
              }
              else
              {
                  cout<<0;
              }
          }
          return 0;
      }
      
      • 0
        @ 2026-6-20 9:37:45
        #include <bits/stdc++.h>
        using namespace std;
        
        int main()
        {
        	int x;
        	cin>>x;
        	if(x<0)
        	{
        		x=-x;
        		cout<<1;
        	}
        	else
        	{
        		cout<<0;
        	}
        	for(int i=30;i>=0;i--)
        	{
        		if(x>>i&1)
        		{
        			cout<<1;
        		}
        		else
        		{
        			cout<<0;
        		}
        	}
        	return 0;
        }
        • 0
          @ 2026-1-3 10:13:00
          #include<bits/stdc++.h>
          using namespace std;
          int main()
          {
          	int x;
          	cin>>x;
          	if(x<0)
          	{
          		x=-x;
          		cout<<1;
          	}
          	else
          	{
          		cout<<0;
          	}
          	bitset<32> a(x);
          	for(int i=30;i>=0;i--)
          	{
          		cout<<a[i];
          	}
          	return 0;
          }
          
          
          • 1

          Information

          ID
          128
          Time
          1000ms
          Memory
          256MiB
          Difficulty
          1
          Tags
          (None)
          # Submissions
          67
          Accepted
          25
          Uploaded By