diff options
| author | Omar Magdy <omar.professional8777@gmail.com> | 2022-05-06 15:01:38 +0200 |
|---|---|---|
| committer | Omar Magdy <omar.professional8777@gmail.com> | 2022-05-06 15:01:38 +0200 |
| commit | 27b754215ceda985f0f8e3b64ab5c5f8e84ab826 (patch) | |
| tree | ff4bf84b578b8f774612c511c9c4ed4e615683fa /python | |
| parent | bfd47647651229dd98734db1b1ef6bdc55dd65d3 (diff) | |
| download | competitive-programming-27b754215ceda985f0f8e3b64ab5c5f8e84ab826.tar.xz competitive-programming-27b754215ceda985f0f8e3b64ab5c5f8e84ab826.zip | |
Solved Combinational lock codeforces
Diffstat (limited to 'python')
| -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) + + |
