来黑子说话!!!!!!

2 comments

  • @ 2024-11-3 12:08:28
    #include <iostream>
    using namespace std;
    int A, B, cnt0, cnt1;
    int main() {
    	int n, t, temp;
    	cin >> n;
    	for (int i = 1; i <= n; i++) {
    		cnt0 = 0, cnt1 = 0;
    		t = i;
    		while (t) {
    			temp = t & 1;
    			t = t >> 1;
    			if (temp) cnt1++;
    			else cnt0++;
    		}
    		cnt1 > cnt0 ? A++ : B++;
    	}
    	cout << A << ' ' << B;
    }
    
    • @ 2024-5-3 15:57:31

      我不是黑子,我是粉丝

      🤡 5
      👍 1
      • 1

      Information

      ID
      1297
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      3
      Tags
      # Submissions
      21
      Accepted
      18
      Uploaded By