fork download
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. string s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  5. void Print(int n,int base)
  6. {
  7. if(n>=base)Print(n/base,base);
  8. cout<<s[n%base];
  9. }
  10.  
  11. void solve() /* Define function solve() to process one case of the problem */
  12. {
  13. int n;
  14. cin>>n;
  15. Print(n,2);
  16. cout<<' ';
  17. Print(n,16);
  18. cout<<endl;
  19.  
  20.  
  21. }
  22.  
  23.  
  24. /******************************************************************************/
  25. /* */
  26. /* DON'T MODIFY main() function anyway! */
  27. /* */
  28. /******************************************************************************/
  29.  
  30. #include <stdio.h>
  31.  
  32. void solve(); /* write function solve() to process one case of the problem */
  33.  
  34. int main()
  35. { int i,t; scanf("%d",&t);
  36. for (i=0;i<t;i++)
  37. { printf("case #%d:\n",i);
  38. solve();
  39. }
  40. return 0;
  41. }
  42.  
Success #stdin #stdout 0s 2964KB
stdin
10
7
17
16
300
1000
100000
0
56789
505
25
stdout
case #0:
111 7
case #1:
10001 11
case #2:
10000 10
case #3:
100101100 12C
case #4:
1111101000 3E8
case #5:
11000011010100000 186A0
case #6:
0 0
case #7:
1101110111010101 DDD5
case #8:
111111001 1F9
case #9:
11001 19