Contar Bits
Problem LinkSolution by TheRealFertos — 100 pts
Code / Notes
#include <bits/stdc++.h>
using namespace std;
int main() {
int k;
cin >> k;
int bitcrush5=0;
for (int i=0; i<10; i++) {
if ((k & (1 << i))) {
bitcrush5++;
}
}
cout << bitcrush5 << endl;
}
Last updated 1 month, 1 week ago