Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions problems/baekjoon/2303_숫자 게임/jaeseok.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
n = int(input())
score = []

for _ in range(n):
card = list(map(int, input().split()))
max_score = 0
for one in range(5):
for two in range(one+1, 5):
for three in range(two+1, 5):
first = (card[one] + card[two] + card[three]) % 10
if max_score < first:
max_score = first
score.append(max_score)

for i in range(n-1, -1, -1):
if score[i] == max(score):
print(i+1)
break
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
a, b, v = map(int, input().split())

# 도달하는 날 x일, 총 올라는 횟수 x번, 내려오는 횟수 (x-1)번
# ax - b(x-1) = v
# x = (v - b) / (a - b)
k = (v - b) / (a - b)
res = int(k) if k == int(k) else int(k) + 1 # 삼항 연산자 사용
print(res)
21 changes: 21 additions & 0 deletions problems/programmers/lv0/OX퀴즈/jaeseok.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# solution 1
def solution(quiz):
answer = []
for i in range(quiz):
res = quiz[i].split()
if res[1] == '+':
if int(res[0]) + int(res[2]) == int(res[4]):
answer.append('O')
else:
answer.append('X')
if res[1] == '-':
if int(res[0]) - int(res[2]) == int(res[4]):
answer.append('O')
else:
answer.append('X')
return answer

# solution 2
# eval 함수는 매개변수로 받은 expression(우리가 아는 일반적인 사칙연산 '식')을 문자열로 받아서, 실행하는 함수다.
def solution(quiz):
return ['O' if eval(i.replace('=', '==')) else 'X' for i in quiz]