刀片式塔式服务器托管注意事项
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)这俩个表达式。
#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)这俩个表达式。
相关文章推荐
- 服务器托管注意事项
- 服务器托管注意事项
- 服务器租用托管时一定要注意的事项,你注意到了么
- Linux 服务器注意事项
- 服务器上配置iis的步骤和注意事项
- C# socket服务器异步监听注意事项
- 使用SVN钩子运行PHP更新服务器代码的注意事项
- 网狐棋牌为服务器大厅加载游戏注意事项
- SSH密钥登陆linux服务器注意事项
- Windows Server 2003 DNS服务器架设注意事项
- 在ANE中连接Socket服务器的注意事项
- Linux上安装Apache,oralce,cognos服务器操作步骤以及注意事项
- 服务器部署注意事项
- 使用windows2003多台服务器网络负载平衡注意事项
- bluehost独立服务器订购注意事项
- 建立图片服务器的注意事项
- tomcat服务器使用注意事项
- HTML 5 服务器发送事件注意事项
- php5.4和apache2.4.9不在同一台服务器的配置注意事项
- XP中搭建IIS6.0服务器注意事项