2851. 슈퍼 마리오

dannyp0930·2021년 9월 8일

BAEKJOON

목록 보기
5/6
post-thumbnail

출처 : 링크텍스트

1. 풀이 방법

100에 가깝게 얻을 수 있는 점수를 100보다 작을 때와 클 때 두 가지 경우를 나누어 풀이하였다.

2. 코드

score1 = 0
score2 = 0
for _ in range(10):
    mushroom = int(input())
    score1 += mushroom
    if score1 >= 100:
        score2 = score1 - mushroom
        break
score = 0
if (score1 - 100) <= (100 - score2):
    score = score1
else:
    score = score2
print(score)
profile
Newbie 개발자

0개의 댓글