boj1268

    技术2025-08-21  12

    #include <stdio.h>#include <stdlib.h>

    int main(){

     int n; int a,b; int c0,c1; int i,k;

     while(scanf("%d",&n) != EOF) //! {  a=b=0;  for(i=1;i<=n;i++)  {   k = i;   c0 = c1 = 0;   while(k != 0)   {    if((k & 1) == 1)     c1++;    else     c0++;    k >>= 1;   }

       if(c1 > c0)    a++;   else    b++;  }

      printf("%d %d/n",a,b); }

     return 0;}

     

    最新回复(0)