Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sstream>
- #include <string>
- #include <iostream>
- using namespace std;
- int main() {
- int n;
- cin >> n;
- std :: string ss("1");
- while (ss.length() < n)
- {
- std::stringstream stream;
- stream << ss;
- for (char ch : ss)
- {
- if (ch = '0')
- {
- stream << '1';
- }
- else
- {
- stream << '0';
- }
- }
- ss = stream.str();
- }
- cout << ss[n - 1];
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement