8 条题解

  • 3
    @ 2026-10-4 9:22:13
    #include <bits/stdc++.h>
    #define LL long long
    using namespace std;
    const int N = 1e5 + 10;
    const int INF = 0x3f3f3f3f;
    int n , m;
    int cnt , sum;
    signed main()
    {
    	   cin >> n >> m;
    	   int ans = (n & m);
    	   while (ans)
    	   {
    		   cnt++;
    		   if(ans & 1)
    		   {
    			   cout << cnt << " ";
    			   sum++;
    		   }
    		   ans >>= 1;
    	   }
    	   if(sum == 0)
    		   cout << 0;
    	   cout << "\n";
    	   if(sum >= 2)
    		   cout << "Yes" << endl;
    	   else
    		   cout << "NO" << endl;
           return 0;
    }
    
    

    信息

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