From 98d71b918b6beb62b2756e73cf9505ebe029048f Mon Sep 17 00:00:00 2001 From: SRASONY Date: Tue, 6 May 2025 19:29:27 +0900 Subject: [PATCH] =?UTF-8?q?[Baekjoon-2503]=20=EC=88=AB=EC=9E=90=20?= =?UTF-8?q?=EC=95=BC=EA=B5=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...3\354\236\220 \354\225\274\352\265\254.py" | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 "BOJ/seulah/14_week/\354\210\253\354\236\220 \354\225\274\352\265\254.py" diff --git "a/BOJ/seulah/14_week/\354\210\253\354\236\220 \354\225\274\352\265\254.py" "b/BOJ/seulah/14_week/\354\210\253\354\236\220 \354\225\274\352\265\254.py" new file mode 100644 index 0000000..01be972 --- /dev/null +++ "b/BOJ/seulah/14_week/\354\210\253\354\236\220 \354\225\274\352\265\254.py" @@ -0,0 +1,37 @@ +# 영수가 생각하는 정답의 모든 수 넣어보기 +# 민혁이가 도전한 내용에 맞는지 확인하기 + +N = int(input()) +hint = [list(map(int,input().split())) for _ in range(N)] +answer = 0 + + +for a in range(1,10): # 백의 자리수 + for b in range(1,10): # 십의 자리수 + for c in range(1,10): # 일의 자리수 + + if (a==b or b==c or c==a): + continue + + cnt = 0 + # 숫자가 정해졌다면 + for number, strike, ball in hint: + ball_cnt , strike_cnt = 0,0 + num = str(number) + x,y,z = int(num[0]), int(num[1]), int(num[2]) + + if a == x : strike_cnt+=1 + if b == y : strike_cnt+=1 + if c == z : strike_cnt+=1 + + if a==y or a==z : ball_cnt+=1 + if b==x or b==z : ball_cnt+=1 + if c==x or c==y : ball_cnt+=1 + + #abc를 number과 비교 + if ball == ball_cnt and strike == strike_cnt: + cnt+=1 + if cnt==N: + answer+=1 + +print(answer) \ No newline at end of file