Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: Changing Digits
Description Given two positive integers *m*contains no leading zeros and has the same length as*n*(We consider*zero*itself a one-digit integer without leading zeros.)*m*is divisible by*k*- among all numbers satisfying properties 1 and 2,
*m*would be the one with least number of digits different from*n* - among all numbers satisfying properties 1, 2 and 3,
*m*would be the smallest one
Input There are multiple test cases for the input. Each test case consists of two lines, which contains Output Output one line for each test case containing the desired number Sample Input 2 2 619103 3219 Sample Output 2 119103 Source POJ Monthly--2007.09.09, Rainer |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator