1067: 密室寻宝(find)

#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <string>
using namespace std;

int main(){
    int p ,q;
    int m,n;
    cin>>p>>q;
    m = p & q;
    int i = 0;
    int k = 0;
    
    while(m > 0)
    {
        i++; 
        if(m % 2 > 0)
        {
            if(k == 0)
                cout<<i; 
            else
                cout<<' '<<i; 
            k++;
        }
        m = m /2 ;
    }
    if(k==0)
    {
        cout<<'0'; 
    }
    if(k>=2)
    {
        cout<<endl<<"Open"<<endl;
    }
    else
    {
        
        cout<<endl<<"Close"<<endl;
    }
    
    return 0;
//    cout<<setiosflags(ios::fixed)<<setprecision(4)<<s<<endl;
//    cout<< setiosflags(ios::fixed)<<setprecision(4) <<c<<endl; 
}

 

posted @ 2017-03-23 22:17  shiningrise  阅读(244)  评论(0编辑  收藏  举报
// 侧边栏目录 // https://blog-static.cnblogs.com/files/douzujun/marvin.nav.my1502.css