|
||||||||||
lockerTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2611 Accepted Submission(s): 1172 Problem Description A password locker with N digits, each digit can be rotated to 0-9 circularly. You can rotate 1-3 consecutive digits up or down in one step. For examples: 567890 -> 567901 (by rotating the last 3 digits up) 000000 -> 000900 (by rotating the 4th digit down) Given the current state and the secret password, what is the minimum amount of steps you have to rotate the locker in order to get from current state to the secret password? Input Multiple (less than 50) cases, process to EOF. For each case, two strings with equal length (¡Ü 1000) consists of only digits are given, representing the current state and the secret password, respectively. Output For each case, output one integer, the minimum amount of steps from the current state to the secret password. Sample Input
Sample Output
Source | ||||||||||
|