fork(4) download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. vector <char> szesnastkowy(int a)
  7. {
  8. char c;
  9. vector <char>b;
  10. while(a!=0)
  11. {
  12. if (a%16>9) c=(char)((a%16)+55);
  13. else c=(char)((a%16)+48);
  14. b.push_back(c);
  15. a=a/16;
  16. }
  17. return b;
  18. }
  19. vector <char> jedenastkowy(int a)
  20. {
  21. char c;
  22. vector <char>b;
  23. while(a!=0)
  24. {
  25. if (a%11>9) c=(char)((a%16)+55);
  26. else c=(char)((a%11)+48);
  27. b.push_back(c);
  28. a=a/11;
  29. }
  30. return b;
  31. }
  32.  
  33. int main()
  34. {
  35. int ile, a;
  36. vector <char> b;
  37. vector <char> c;
  38. cin >> ile;
  39. for (int i=0; i<ile; i++)
  40. {
  41. cin >> a;
  42. if (a==0) cout << "0 0" << endl;
  43. else {
  44. b=szesnastkowy(a);
  45. for (int j=b.size()-1; j>=0; j--)
  46. cout << b[j];
  47. cout << " ";
  48. c=jedenastkowy(a);
  49. for (int j=c.size()-1; j>=0; j--)
  50. cout << c[j];
  51. cout << endl;}
  52. }
  53. return 0;
  54. }
  55.  
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
Standard output is empty