Do you know why base 10 number system is so easy to understand to us? The only reason base-10 math seems "natural" and the other bases don't is that you've been doing base-10 since you were a child. And (nearly) every civilization has used base-10 math probably for the simple reason that we have ten fingers. If instead we lived in a cartoon world, where we would have only four fingers on each hand (count them next time you're watching TV or reading the comics), then the "natural" base system would likely have been base-eight, or "octal". Other than base 10, binary, octal and hexadecimal are popularly known number bases that we use. But number can be in lot more bases than these few. For example, we can consider base 4 or base 22. In this problem you will be given a decimal number and you have to convert that number to a destination base. Input: ------ The first line of the input contains an integer, **T**, representing the number of test cases **(1 ≤ T ≤ 100)**. For each test case, two numbers separated by comma, the first one contains a number **N (0 ≤ N ≤ 2^31-1)**, representing the decimal number and the second one contains a number **B (2 ≤ B ≤ 35)**, representing the destination number system base. Output: ------- For each test case the output should contain a single line with the number in the destination base number system. For base greater than 10, letters A to Z should be used to represent the digit in that base where A means 10, B means 11, C means 12 and so on up to Z. Sample Input ------------ 4 10,2 100,5 999,9 135534,22 Sample Output ------------- 1010 400 1330 CG0E

MD. Jalal Uddin

Language |
Time Limit (seconds) |

C | 1.00 |

C++ | 1.00 |

C++14 | 1.00 |

C# | 2.00 |

Go | 2.00 |

Java | 2.00 |

JavaScript | 2.00 |

Objective-C | 2.00 |

Perl | 2.00 |

PHP | 2.00 |

Python | 2.00 |

Python3 | 2.00 |

Ruby | 2.00 |

VB.Net | 2.00 |

Solve/Submission

# | User | Language | Timing |
---|---|---|---|

01 | tariqiitju | Cpp14 | 0.00s |

02 | absa1am | Cpp14 | 0.00s |

03 | Logic_Hunter | Cpp14 | 0.00s |

04 | SKL12 | Cpp14 | 0.00s |

05 | Indro_BU | Cpp14 | 0.00s |

06 | sazal_dev | Cpp14 | 0.00s |

07 | ash12 | Cpp14 | 0.00s |

08 | Mr_KAJOL_JUST | Cpp14 | 0.00s |

09 | Masum_ice | Cpp14 | 0.00s |

10 | deder | Cpp14 | 0.00s |

11 | onucsecu | Cpp14 | 0.00s |

12 | Dragon_162 | Cpp14 | 0.00s |

13 | Ansarul_14 | Cpp14 | 0.00s |

14 | Rajan_sust | Cpp14 | 0.00s |

15 | murad_al_wajed | Cpp14 | 0.00s |

16 | seyedssz | Cpp14 | 0.00s |

17 | joy25896 | Cpp14 | 0.00s |

18 | Momin_just | Cpp14 | 0.00s |

19 | afzalul | Cpp14 | 0.00s |

20 | porag_ict | Cpp14 | 0.00s |

21 | bpr10ry | Cpp14 | 0.00s |

22 | lolcoder | Cpp14 | 0.00s |

23 | rithu | Cpp14 | 0.00s |

24 | waqqas | Cpp14 | 0.00s |

25 | lightlessShadO | Cpp14 | 0.00s |

26 | mrinmoi | Cpp | 0.00s |

27 | subhashis_cse | Cpp | 0.00s |

28 | pulak_ict_mbstu | Cpp14 | 0.00s |

29 | khmahbub20 | Cpp | 0.00s |

30 | tico88612 | Cpp | 0.01s |

31 | anik_JU | Cpp14 | 0.01s |

32 | Nazmul_7 | Cpp14 | 0.01s |

33 | Ashish972 | Cpp14 | 0.01s |

34 | nazmul_bzs | Cpp14 | 0.01s |

35 | emrul | Cpp14 | 0.01s |

36 | Rahat_BU | Cpp14 | 0.01s |

37 | BishalG | CSharp | 0.02s |

38 | mhsjaber | CSharp | 0.03s |

39 | tanmoycsit | CSharp | 0.05s |

40 | mhmbd | CSharp | 0.05s |

41 | Dinar | Cpp14 | 0.07s |

42 | MAHRahat | Cpp14 | 0.08s |

43 | mahbub07 | Cpp14 | 0.30s |

44 | codehead | Cpp14 | 0.31s |

45 | froghramar | Cpp14 | 0.39s |

46 | moshiur_cse15 | Cpp14 | 0.40s |

47 | abd_iubat | Cpp14 | 0.40s |

48 | sharifulalam | Cpp14 | 0.40s |

49 | myhobby | Cpp14 | 0.43s |

50 | njrafi | Cpp14 | 0.46s |

Copyright © 2015-2016 Dev Skill.

Feedback
#### Your feedback is our precious!

## Thank you for providing feedback! Our developers will be happy :)

## Sorry there was a problem when submitting the feedback. Please try again. :(