Skip to content

Commit

Permalink
Create 1-9_StairGame.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jisunp04023 authored Oct 20, 2023
1 parent 5e310ac commit d24b544
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions 1-9_StairGame.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# UTF-8 encoding when using korean

def func(record):
if record == 0:
return 1
elif record == 1:
return 2
return 0

def solution(recordA, recordB):
cnt = 0
for i in range(len(recordA)):
if recordA[i] == recordB[i]:
continue
elif recordA[i] == func(recordB[i]):
cnt = cnt + 3
else:
if not cnt:
cnt = cnt - 1
return cnt

recordA = [2,0,0,0,0,0,1,1,0,0]
recordB = [0,0,0,0,2,2,0,2,2,2]
ret = solution(recordA, recordB)


print("solution 함수의 반환 값은", ret, "입니다.")

0 comments on commit d24b544

Please sign in to comment.