프로그래밍/HackerRank
[HackerRank][Python3] Lisa's Workbook
snoopybox
2018. 9. 6. 22:21
Problem :
https://www.hackerrank.com/challenges/lisa-workbook/problem
My Solution :
#!/usr/bin/env python3 def workbook(n, k, arr): special = 0 page = 1 for problems in arr: for number in range(1, problems + 1): if page == number: special += 1 if number % k == 0: page += 1 if number % k != 0: page += 1 return special n, k = map(int, input().split()) arr = list(map(int, input().rstrip().split())) result = workbook(n, k, arr) print(result)