atoi:
#include
int atoi(const char* str)
{
assert(NULL != str);
while(' ' == *str)
++str;
bool sign_flag = 0;
if('-' == *str)
{
sign_flag = 1;
++str;
}
int sum = 0;
while(*str <= '9' && *str >= '0')
{
sum = sum * 10 + *str - '0';
++str;
}
if(sign_flag)
return -sum;
return sum;
}
int main(int argc, char* argv[])
{
char str[12];
std::cin >> str;
std::cout << atoi(str) << std::endl;
return 0;
}
#include
int main(int argc, char* argv[])
{
int n = 0;
int count = 0;
scanf("%d", &n);
while(n != 0)
{
++count;
n = n & (n - 1);
}
printf("%d/n", count);
}