A. Div. 7
You are given an integer . You have to change the minimum number of digits in it in such a way that the resulting number does not have any leading zeroes and is divisible by .
If there are multiple ways to do it, print any of them. If the given number is already divisible by , leave it unchanged.
The first line contains one integer () — the number of test cases.
Then the test cases follow, each test case consists of one line containing one integer ().
For each test case, print one integer without any leading zeroes — the result of your changes (i. e. the integer that is divisible by and can be obtained by changing the minimum possible number of digits in ).
If there are multiple ways to apply changes, print any resulting number. If the given number is already divisible by , just print it.
In the first test case of the example, is already divisible by , so there's no need to change it.
In the second test case of the example, there are multiple answers — , or .
In the third test case of the example, other possible answers are , and . Note that you cannot print or .
Solution:
solution link 1
https://shareus.in/?i=GZatxNl0g
if 1st link is not work then click on another link
Solution link 2
Solution link 3
Solution link 4
How to get link tutorial video link
No comments:
Post a Comment