diff options
Diffstat (limited to 'python/CombinationLock.py')
| -rw-r--r-- | python/CombinationLock.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/python/CombinationLock.py b/python/CombinationLock.py new file mode 100644 index 0000000..0ac8b2c --- /dev/null +++ b/python/CombinationLock.py @@ -0,0 +1,12 @@ +t = int(input()) +count = 0 +n1 = input() +n2 = input() +for i in range(len(n1)): + if abs(int(n1[i]) - int(n2[i])) > 5: + count+= 10 - max(int(n1[i]),int(n2[i])) + min(int(n1[i]),int(n2[i])) + else: + count+=abs(int(n1[i]) - int(n2[i])) +print(count) + + |
