5 条题解

  • 2
    @ 2023-4-29 11:01:35
    #include<bits/stdc++.h>
    using namespace std;
    #define int long long
    int p,q;
    int cnt,sum;
    signed main(){
    	cin>>p>>q;
    	int ans=(p&q);
    	while(ans!=0){
    		cnt++;
    		if(ans%2){
    			cout<<cnt<<" ";
    			sum++;
    		}
    		ans/=2;
    	}
    	if(sum==0){
    		cout<<0<<endl;
    	}
    	cout<<endl;
    	if(sum>=2){
    		cout<<"Yes"<<endl;
    	}
    	else{
    		cout<<"NO"<<endl;
    	}
        return 0;
    }
    
    

    信息

    ID
    2554
    时间
    1000ms
    内存
    256MiB
    难度
    7
    标签
    递交数
    784
    已通过
    169
    上传者