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 | njrafi | Cpp14 | 0.00s |

02 | cse_nazmul | Cpp | 0.00s |

03 | atik | Cpp14 | 0.00s |

04 | demon | Cpp | 0.00s |

05 | asiuzzaman006 | Cpp | 0.00s |

06 | obujgalib | Cpp | 0.00s |

07 | KNUTH | Cpp | 0.00s |

08 | nafiz0080 | Cpp14 | 0.00s |

09 | akib9ctg | Cpp14 | 0.00s |

10 | Jakir_Hossain_Sust | Cpp14 | 0.00s |

11 | ksohan | Cpp | 0.00s |

12 | duronto20 | Cpp | 0.00s |

13 | Digonta | Cpp14 | 0.00s |

14 | ArifKhanShubro | Cpp | 0.00s |

15 | absa1am | Cpp14 | 0.00s |

16 | badhansen123 | Cpp | 0.00s |

17 | subhashis_cse | Cpp | 0.00s |

18 | taskin1995 | Cpp | 0.00s |

19 | Zayed | Cpp14 | 0.00s |

20 | aseem_cu | Cpp14 | 0.00s |

21 | foysal_007 | Cpp14 | 0.00s |

22 | anikatahsin | Cpp14 | 0.00s |

23 | Puja1409 | Cpp14 | 0.00s |

24 | HR_Habib | Cpp | 0.00s |

25 | sumon23 | Cpp14 | 0.00s |

26 | ssavi | Cpp14 | 0.00s |

27 | Trusted_Frustrated | Cpp | 0.00s |

28 | Shakil_Mahmud | Cpp | 0.00s |

29 | haasib | Cpp | 0.00s |

30 | showmic | Cpp14 | 0.00s |

31 | zyyxxx | Cpp14 | 0.00s |

32 | simantaturja | Cpp14 | 0.00s |

33 | emrul | Cpp | 0.00s |

34 | Foysol_Ahmed | Cpp14 | 0.00s |

35 | Yeasin10A | Cpp14 | 0.00s |

36 | tariqiitju | Cpp | 0.00s |

37 | Linkon_Ruhul | Cpp | 0.00s |

38 | Tanmoy | Cpp14 | 0.00s |

39 | Najat | Cpp14 | 0.00s |

40 | Knight_King | Cpp14 | 0.00s |

41 | uzzal_rahman | Cpp | 0.00s |

42 | mubdiur | Cpp | 0.00s |

43 | Mr_adnan | Cpp14 | 0.00s |

44 | Masum_ice | Cpp14 | 0.00s |

45 | akram | Cpp14 | 0.00s |

46 | Arpan_cse_2k14 | Cpp14 | 0.00s |

47 | prodipdatta7 | Cpp14 | 0.00s |

48 | shahincsejnu | Cpp | 0.00s |

49 | The_Viper | Cpp | 0.00s |

50 | Aman_khan | Cpp | 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. :(