++++++++[>+>++>+++>++++>+++++>++++++>+++++++>++++++++>+++++++++>++++++++++>+ ++++++++++>++++++++++++>+++++++++++++>++++++++++++++>+++++++++++++++>+++++++ +++++++++<<<<<<<<<<<<<<<<-]>>>>>>>>>>.<<<<<<<<<<>>>>>>>>>>>>>>++.--<<<<<<<<< <<<<<>>>>>>>>>>>>>+.-<<<<<<<<<<<<<>>>>>>>>>>>>>>--.++<<<<<<<<<<<<<<>>>>>>>>> >>>>>>----.++++<<<<<<<<<<<<<<<>>>>.<<<<>>>>>>>>>>>>>>--.++<<<<<<<<<<<<<<>>>> >>>>>>>>>>>---.+++<<<<<<<<<<<<<<<>>>>>>>>>>>>>>---.+++<<<<<<<<<<<<<<>>>>>>>> >>>>++.--<<<<<<<<<<<<>>>>>>>>>>>>>---.+++<<<<<<<<<<<<<>>>>>>>>>>>>>>++.--<<< <<<<<<<<<<<. DCBA:^!~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHdcbD`Y^]\UZYRv 9876543210/.-,+*)('&%$#"!~}|{zyxwvutsrqponm+*)('&%$#cya`=^]\[ZYXWVUTSRQPONML KJfe^cba`_X]VzTYRv98TSRQ3ONMLEi,+*)('&%$#"!~}|{zyxwvutsrqponmlkjihgfedcba`_^ ]\[ZYXWVUTSonPlkjchg`ed]#DCBA@?>=<;:9876543OHGLKDIHGFE>b%$#"!~}|{zyxwvutsrqp onmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMibafedcba`_X|?>Z<XWVUTSRKo\
v34*8+6+,78+9*3+,93+9*5+,28+9*1+,55+9*4+,23*6*2*,91,@,+7*9*25,*48,+3*9+38,+< >62*9*2+,34*9*3+,66+9*8+,52*9*7+,75+9*8+,92+9*6+,48+9*3+,43*9*2+,84*,26*9*3^
The input contains a single integer a (0 ≤ a ≤ 1 000 000).
Output a single integer.
129
1
#include<stdio.h> #include<iostream> #include<string.h> #include<string> #include<ctype.h> #include<math.h> #include<set> #include<map> #include<vector> #include<queue> #include<bitset> #include<algorithm> #include<time.h> using namespace std; void fre() { freopen("c://test//input.in", "r", stdin); freopen("c://test//output.out", "w", stdout); } #define MS(x,y) memset(x,y,sizeof(x)) #define MC(x,y) memcpy(x,y,sizeof(x)) #define MP(x,y) make_pair(x,y) #define ls o<<1 #define rs o<<1|1 typedef long long LL; typedef unsigned long long UL; typedef unsigned int UI; template <class T1, class T2>inline void gmax(T1 &a, T2 b) { if (b>a)a = b; } template <class T1, class T2>inline void gmin(T1 &a, T2 b) { if (b<a)a = b; } const int N = 0, M = 0, Z = 1e9 + 7, ms63 = 0x3f3f3f3f; int n; int main() { while (~scanf("%d", &n)) { int ans = 0; while (n) { ans += (n % 8 == 1); n /= 8; } printf("%d\n", ans); } return 0; } /* 【题意】 输入一个数的8进制表示中1的个数 【类型】 奇特语言 【数据】 Print number (Brainfuck) — http://ideone.com ++++++++[>+>++>+++>++++>+++++>++++++>+++++++>++++++++>+++++++++>++++++++++>+ ++++++++++>++++++++++++>+++++++++++++>++++++++++++++>+++++++++++++++>+++++++ +++++++++<<<<<<<<<<<<<<<<-]>>>>>>>>>>.<<<<<<<<<<>>>>>>>>>>>>>>++.--<<<<<<<<< <<<<<>>>>>>>>>>>>>+.-<<<<<<<<<<<<<>>>>>>>>>>>>>>--.++<<<<<<<<<<<<<<>>>>>>>>> >>>>>>----.++++<<<<<<<<<<<<<<<>>>>.<<<<>>>>>>>>>>>>>>--.++<<<<<<<<<<<<<<>>>> >>>>>>>>>>>---.+++<<<<<<<<<<<<<<<>>>>>>>>>>>>>>---.+++<<<<<<<<<<<<<<>>>>>>>> >>>>++.--<<<<<<<<<<<<>>>>>>>>>>>>>---.+++<<<<<<<<<<<<<>>>>>>>>>>>>>>++.--<<< <<<<<<<<<<<. of ones in (Malbolge) — http://www.malbolge.doleczek.pl/ DCBA:^!~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHdcbD`Y^]\UZYRv 9876543210/.-,+*)('&%$#"!~}|{zyxwvutsrqponm+*)('&%$#cya`=^]\[ZYXWVUTSRQPONML KJfe^cba`_X]VzTYRv98TSRQ3ONMLEi,+*)('&%$#"!~}|{zyxwvutsrqponmlkjihgfedcba`_^ ]\[ZYXWVUTSonPlkjchg`ed]#DCBA@?>=<;:9876543OHGLKDIHGFE>b%$#"!~}|{zyxwvutsrqp onmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMibafedcba`_X|?>Z<XWVUTSRKo\ base 8 (Piet) — http://www.rapapaing.com/blog/?page_id=6 pictures notation of a (Befunge) — http://www.quirkster.com/iano/js/befunge.html */