1 solutions

  • 0
    @ 2026-8-26 10:33:25
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int a,cnt=0;
    	cin>>a;
    	for(int i=1;i<=a;i++)
    	{
    		int n,x=2;
    		cin>>n;
    		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());
    		for(int j=0;j<s.size();j++)
    		{
    			if(s[j]=='1')
    			{
    				cnt++;
    			}
    			
    		}
    	}
    	if(cnt%2!=0)
    	{
    		cout<<cnt<<" "<<'1';
    		
    	}
    	else
    	{
    		cout<<cnt<<" "<<'0';
    	}
    	return 0;
    }
    
    

    Information

    ID
    2807
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    3
    Tags
    # Submissions
    16
    Accepted
    9
    Uploaded By