您的位置:首页 > 运维架构

【杭电】[4349]Xiao Ming's Hope

2016-04-13 22:53 246 查看




上次比赛问的是

杨辉三角第n行奇数的个数

和这个本质上是一样的

lucas定理的推广

参考了宇神的博客

hdoj 4349 Xiao Ming’s Hope 【lucas 推广】

#include<stdio.h>
int main() {
int n;
while(scanf("%d",&n)!=EOF) {
int cnt=0;
while(n) {
if(n&1)
cnt++;
n>>=1;
}
printf("%d\n",1<<cnt);
}
return 0;
}


题目地址:【杭电】[4349]Xiao Ming’s Hope
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  杭电 lucas