P10508 题解
思路
题目并没有说数据范围,所以我们需要打开文件看一看。不难发现,所有的数字都在 long long 范围内。
然后就可以按照题目要求:输入
#include<bits/stdc++.h>
using namespace std;
#define int long long
int read(){int x=0;char f=1,ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();return x*f;}
signed main(){
freopen("numlist.txt","r",stdin);
int res=0;
for(int i=1;i<=1000;++i){
int x=read();
while(!(x&1)){
++res;
x>>=1;
}
}
printf("%lld\n",res);
return 0;
}
AC CODE
为了简洁,这里用 Python。
print(251)