GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Monday, 23 May 2022

Required Length Codeforces Solution | Codeforces Problem Solution 2022

D. Required Length
time limit per test
2 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output

You are given two integer numbers, n and x. You may perform several operations with the integer x.

Each operation you perform is the following one: choose any digit y that occurs in the decimal representation of x at least once, and replace x by xy.

You want to make the length of decimal representation

 Solution Click Below:-  CLICK HERE

of x (without leading zeroes) equal to n. What is the minimum number of operations required to do that?


Output

Print one integer — the minimum number of operations required to make the length of decimal representation of x (without leading zeroes) equal to n, or 1 if it is impossible.

No comments:

Post a Comment