Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <sstream>
  2. #include <string>
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. int main() {
  7. int n;
  8. cin >> n;
  9. std :: string ss("1");
  10. while (ss.length() < n)
  11. {
  12. std::stringstream stream;
  13. stream << ss;
  14. for (char ch : ss)
  15. {
  16. if (ch = '0')
  17. {
  18. stream << '1';
  19. }
  20. else
  21. {
  22. stream << '0';
  23. }
  24. }
  25. ss = stream.str();
  26. }
  27.  
  28. cout << ss[n - 1];
  29. system("pause");
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement