#include <stdio.h>int main(){ int n; scanf("%d",&n); while(n--) { int m,sum=0,t=0; scanf("%d",&m); while(m) { if(m&1) sum++; m>>=1; t++; } printf("%d\n",sum+t-2); } return 0;}
#include <stdio.h>int main(){ int a[5000]={0,1},co=1,n; scanf("%d",&n); for(int i=2;i<=n;i++) { int jinwei=0; for(int j=1;j<=co;j++) { a[j]=a[j]*i+jinwei; if(a[j]/10000) { jinwei=a[j]/10000; a[j]%=...
描述
Given two strings A and B, whose alphabet consist only ‘0’ and ‘1’. Your task is only to tell how many times does A appear as a substring of B? For example, the text string B is ‘1001110110’ while the pattern string A is ‘11’, you should output 3, because the pattern A appeared at the posit
...