프로그래밍/HackerRank
[HackerRank][Python3] Jumping on the Clouds
snoopybox
2018. 9. 6. 01:04
Problem :
https://www.hackerrank.com/challenges/jumping-on-the-clouds/problem
My Solution :
#!/usr/bin/env python3 def jumping_on_clouds(c): count = i = 0 while i < len(c)-1: count += 1 if i+2 < len(c) and c[i+2]: i += 1 else: i += 2 return count n = int(input()) c = list(map(int, input().rstrip().split())) result = jumping_on_clouds(c) print(result)