[νλ‘κ·Έλλ¨Έμ€-Lv1] λ‘λμ μ΅κ³ μμμ μ΅μ μμ / Python
π Problem Solving/Programmers
https://programmers.co.kr/learn/courses/30/lessons/77484
import sys
input = sys.stdin.readline
lottos = list(map(int, input().split()))
win_nums = list(map(int, input().split()))
def solution(lottos, win_nums):
if sum(lottos) == 0:
return [1, 6]
cnt = 0
for i in lottos:
if i in win_nums:
cnt += 1
zero = lottos.count(0)
if cnt == 0 and zero == 0:
return [6, 6]
return [7 - (cnt + zero), 7 - cnt]
print(solution(lottos, win_nums))
ν΄μ€
7 - μ΄λ―Έ λ§μ κ°μκ° μ΅μ μμ, 7 - μ΄λ―Έ λ§μ κ°μ + 0μ κ°μκ° μ΅κ³ μμλ€.
μ¬κΈ°μ λ°λ‘ μκ°ν λΆλΆμ λͺ¨λ μκ° 0μΌ λμ, λ§μ κ°μλ μκ³ 0μ κ°μλ μμ λ λ κ°μ§ κ²½μ°μ΄λ€.
λͺ¨λ μκ° 0μ΄λ©΄ 1λ±λ ν μ μκ³ , 6λ±λ ν μ μλ€.
λ§μ κ°μμ 0μ κ°μκ° λͺ¨λ μμΌλ©΄ μ΄ λλ 6λ±λ°μ ν μ μλ€.
'π Problem Solving > Programmers' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[νλ‘κ·Έλλ¨Έμ€-Lv1] ν€ν¨λ λλ₯΄κΈ° / Python (0) | 2021.06.01 |
---|---|
[νλ‘κ·Έλλ¨Έμ€-Lv1] μμ λνκΈ° / Python (0) | 2021.06.01 |
[νλ‘κ·Έλλ¨Έμ€-Lv1] μμ λ§λ€κΈ° / Python (0) | 2021.06.01 |
[νλ‘κ·Έλλ¨Έμ€-Lv1] ν°μΌλͺ¬ / Python (0) | 2021.06.01 |
[νλ‘κ·Έλλ¨Έμ€-Lv1] λ΄μ / Python (0) | 2021.06.01 |