现在的位置: 首页 > 综合 > 正文

2629: 排列与二进制

2013年03月07日 ⁄ 综合 ⁄ 共 204字 ⁄ 字号 评论关闭

#include<stdio.h>
int main()
{
 int n,m;
 while(scanf("%d%d",&n,&m)==2&&n)
 {
  int i,count=0;
  for(i=n-m+1;i<=n;i++)
  {
   int b=i;
   while(b%2==0)
   {
    b/=2;
    count++;
   }
  }
  printf("%d/n",count);
 }
 return 0;
}

抱歉!评论已关闭.