fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6. int n;
  7. string s, s1;
  8. cin>>n;
  9. while(n != 0){
  10. if (n % 2 == 0) s += "0";
  11. else s += "1";
  12. n = n / 2;
  13. }
  14. for (int i = s.size() - 1; i >= 0; i--) {
  15. if (s[i] == '1') s1 += "SX";
  16. else s1 += "S";
  17. }
  18. s1.erase(0, 2);
  19. cout<<s1;
  20.  
  21. return 0;
  22. }
Success #stdin #stdout 0s 4392KB
stdin
3
stdout
SX