Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- //#include <string>
- #include <chrono>
- using namespace std;
- int main()
- {
- auto begin = chrono::high_resolution_clock::now();
- int n = 23;
- //std::cin >> n;
- std::string str = "";
- while (n != 0)
- {
- if (n % 2 == 0)
- {
- str.insert(0, "S");
- }
- else { str.insert(0, "SX"); }
- n /= 2;
- }
- //str = "SXabcdefgh";
- if (str.substr(0,2) == "SX")
- {
- cout << str.substr(2).c_str() << '\n';
- }
- else cout << str.c_str() << '\n';
- cout << str.c_str() << '\n';
- auto end = chrono::high_resolution_clock::now();
- chrono::duration<float> time = end - begin;
- cout << time.count() << '\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement