8์ ๋ชจ์์ ์ ๊ตฌ ๋ฌถ์ - 0๋ถํฐ 9๊น์ง์ ์ซ์๋ฅผ ํํ
์ ๊ตฌ๊ฐ ์ผ์ก์ผ๋ฉด ๊ฒ์ ์(1), ๊บผ์ก์ผ๋ฉด ์ ์ ํ์(0)์ผ๋ก ํํ
import sys
input = sys.stdin.readline
info = {
'0' : '1110111',
'1' : '0010010',
'2' : '1011101',
'3' : '1011011',
'4' : '0111010',
'5' : '1101011',
'6' : '1101111',
'7' : '1110010',
'8' : '1111111',
'9' : '1111011',
' ' : '0000000'
}
T = int(input())
for _ in range(T):
a,b = map(str,input().split())
#์ ์ฒ๋ฆฌ
a_zero, b_zero = 5-len(a), 5-len(b)
a = ' ' * a_zero + a
b = ' ' * b_zero + b
result = 0
for i in range(5):
if a[i] != b[i]:
for j in range(7):
if info[a[i]][j] != info[b[i]][j]:
result += 1
print(result)
'Algorithm > Softeer' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Softeer - level3] ์ค๋งํธ ๋ฌผ๋ฅ (0) | 2023.07.24 |
---|---|
[Softeer - level3] ํ๋ฐฐ ๋ง์คํฐ ๊ด์ฐ (0) | 2023.07.24 |
[Softeer - level2] [21๋ ์ฌ์ง์ ๋ํ ์์ ] ๋น๋ฐ ๋ฉ๋ด (0) | 2023.07.23 |
[Softeer - level2] GBC (0) | 2023.07.23 |
[Softeer - level1] ๋ฌธ์ ํ์ด (0) | 2023.07.21 |