Beginner Beginners Problems > Ad-hoc

**Akash** is good at mathematics. One day his father give him a problem. He gives Akash two positive integers **N** and **P**. Akash has to find the ***largest number that can be formed by replacing digits at at most P places in the Number N***. Akash seems that the problem is very tough for him. So he asked you for your help. You will be given two positive integers **N** and **P**. You have to output the largest integer number that can be made by the above procedure. Input: ------ The first line of the input is the number of test cases **T(1 ≤ T ≤ 80)**.<br> Each of the **T** lines contains two integers **N(1 ≤ N ≤ 10^18)** and **P(0 ≤ P ≤ 9)** separated by a single space. Output: ------- For each test case, print a single line **“Case A: X"**(without quotation marks)starting from one in one line. Here **A** is the case number and **X** is the largest number. Sample Input ------------ 2 193 2 70843010538381368 7 Sample Output ------------- Case 1: 999 Case 2: 99999990538381368

MD. Hasibul Hasan

Language |
Time Limit (seconds) |

C | 1.00 |

C++ | 1.00 |

C++14 | 1.00 |

C# | 3.00 |

Go | 3.00 |

Java | 3.00 |

JavaScript | 3.00 |

Objective-C | 3.00 |

Perl | 3.00 |

PHP | 3.00 |

Python | 3.00 |

Python3 | 3.00 |

Ruby | 3.00 |

VB.Net | 3.00 |

Solve/Submission

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

01 | hrOarr | Cpp14 | 0.00s |

02 | Mr_adnan | Cpp14 | 0.00s |

03 | anik_JU | Cpp14 | 0.00s |

04 | pulak_ict_mbstu | Cpp14 | 0.00s |

05 | FariD | Cpp14 | 0.00s |

06 | badhansen123 | Cpp | 0.00s |

07 | Arpan_cse_2k14 | Cpp14 | 0.00s |

08 | Yeasin10A | Cpp14 | 0.00s |

09 | showmic | Cpp14 | 0.00s |

10 | Bruteforcekid | Cpp14 | 0.00s |

11 | subhashis_cse | Cpp | 0.00s |

12 | Zayed | Cpp14 | 0.00s |

13 | Maruf_75 | Cpp | 0.00s |

14 | zip_light | Cpp14 | 0.00s |

15 | SakibAlamin | Cpp14 | 0.00s |

16 | mir_lutfur_rahman | Cpp14 | 0.00s |

17 | Jakir_Hossain_Sust | Cpp14 | 0.00s |

18 | kakarotto | Cpp | 0.00s |

19 | bu_hridoy | Cpp14 | 0.00s |

20 | Knight_King | Cpp14 | 0.00s |

21 | KNUTH | Cpp | 0.00s |

22 | obujgalib | Cpp | 0.00s |

23 | _GhOstMan_ | Cpp14 | 0.00s |

24 | ArifKhanShubro | Cpp | 0.00s |

25 | Atik_Ahamed | Cpp14 | 0.00s |

26 | jayed_al_hasan | Cpp14 | 0.00s |

27 | IIUC_minhazmiraz | Cpp14 | 0.00s |

28 | mir003 | Cpp | 0.00s |

29 | AlaminJust | Cpp14 | 0.00s |

30 | Digonta | Cpp14 | 0.00s |

31 | joymollick | Cpp14 | 0.00s |

32 | tlcakash | Cpp14 | 0.00s |

33 | sharifulalam | Cpp14 | 0.00s |

34 | ssohan | Cpp14 | 0.00s |

35 | Tanmoy | Cpp14 | 0.00s |

36 | prodipdatta7 | Cpp14 | 0.00s |

37 | atik | Cpp14 | 0.00s |

38 | azizsabuj | Cpp14 | 0.00s |

39 | akib9ctg | Cpp14 | 0.00s |

40 | johnbrightnew01 | Cpp | 0.00s |

41 | aseem_cu | Cpp14 | 0.00s |

42 | nurshuvo51 | Cpp14 | 0.00s |

43 | smriad | Cpp | 0.00s |

44 | Ishrak | Cpp | 0.00s |

45 | emrul | Cpp14 | 0.00s |

46 | _dipu | Cpp14 | 0.00s |

47 | mhiceiu | Cpp | 0.00s |

48 | mohibur | Cpp14 | 0.00s |

49 | Raka143 | Cpp14 | 0.00s |

50 | lolcoder | Cpp14 | 0.00s |

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. :(