Skip to content

Commit cccfd3c

Browse files
committed
day26
1 parent 80ba27f commit cccfd3c

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# 풀이방법: 단어의 글자수에 따라 계산한다
2+
# 점수계산: 몫은 순서대로 8을 곱하고 나머지는 몫+1 곱하기
3+
# 예) 17개 -> 8*1 + 8*2 + 1*3 = 27
4+
# 예) 5개 -> 8*0 + 5*1 = 5
5+
# 예) 12개 -> 8*1 + 4*2 = 16
6+
class Solution:
7+
def minimumPushes(self, word: str) -> int:
8+
cnt = len(word) // 8
9+
ans = sum([i for i in range(cnt + 1)]) * 8
10+
ans += (cnt + 1) * (len(word) % 8)
11+
return ans

0 commit comments

Comments
 (0)