diff --git "a/leetcode3/\353\202\250\355\232\250\354\240\225/3014. Minimum Number of Pushes to Type Word I.py" "b/leetcode3/\353\202\250\355\232\250\354\240\225/3014. Minimum Number of Pushes to Type Word I.py" new file mode 100644 index 00000000..b4dac54f --- /dev/null +++ "b/leetcode3/\353\202\250\355\232\250\354\240\225/3014. Minimum Number of Pushes to Type Word I.py" @@ -0,0 +1,11 @@ +# 풀이방법: 단어의 글자수에 따라 계산한다 +# 점수계산: 몫은 순서대로 8을 곱하고 나머지는 몫+1 곱하기 +# 예) 17개 -> 8*1 + 8*2 + 1*3 = 27 +# 예) 5개 -> 8*0 + 5*1 = 5 +# 예) 12개 -> 8*1 + 4*2 = 16 +class Solution: + def minimumPushes(self, word: str) -> int: + cnt = len(word) // 8 + ans = sum([i for i in range(cnt + 1)]) * 8 + ans += (cnt + 1) * (len(word) % 8) + return ans \ No newline at end of file