您的位置:首页 > 其它

刀片式塔式服务器托管注意事项

2012-05-10 17:42 162 查看
#include<stdio.h>
#include<stdlib.h>

int main()
{
int diff_count();
int num1 = 0;
int num2 = 0;
scanf("%d", &num1);
scanf("%d", &num2);
int ret = diff_count(num1, num2);
printf("%d\n", ret);
return 0;
}

int diff_count(int x, int y)
{
int tmp = x^y;
int count = 0;
while (tmp)
{
count++;
tmp &= (tmp - 1);
}
return count;
}
理解x^y的含义以及tmp &= (tmp - 1)这俩个表达式。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: