fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int i,n;
  6. cin>>n;
  7. for(i=1;i<=10000;i++)
  8. {
  9. if(__builtin_popcount(i)==n)
  10. {
  11. cout<<i<<endl;
  12. }
  13. }
  14. return 0;
  15. }
Success #stdin #stdout 0s 15240KB
stdin
1
stdout
1
2
4
8
16
32
64
128
256
512
1024
2048
4096
8192