Untitled
unknown
plain_text
2 years ago
375 B
5
Indexable
#include <iostream> #include <algorithm> #include <vector> #include <string> using namespace std; string perevod(int a) { string h = ""; int k = a; while (k != 1){ h += to_string(k % 2); k /= 2; } h += "1"; string l; for (int i = h.size()-1; i >=0; i--) { l += h[i]; } return l; } int main() { int a; cin >> a; cout << perevod(a); }
Editor is loading...