YauhenMardan

TA Bin

Mar 21st, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <fstream>
  2.  
  3. int main(int argc, const char * argv[]) {
  4. std::ifstream fin("input.txt");
  5. std::ofstream fout("output.txt");
  6. int n;
  7. fin>>n;
  8. int i=0;
  9. if(n==0){
  10. fout<<"-1\n";
  11. }
  12. while(n!=0){
  13. if(n%2){
  14. fout<<i<<"\n";
  15. }
  16. n/=2;
  17. i++;
  18. }
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment