solution to sportsball
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import itertools
|
||||
import sys
|
||||
|
||||
|
||||
def run(nums):
|
||||
best = 0
|
||||
for i in xrange(len(nums)):
|
||||
if nums[i] % 2 == 1:
|
||||
cur_best = nums[i]
|
||||
if cur_best > best: best = cur_best
|
||||
for j in xrange(i + 1, len(nums)):
|
||||
if nums[j] % 2 == 0:
|
||||
break
|
||||
cur_best += nums[j]
|
||||
if cur_best > best:
|
||||
best = cur_best
|
||||
print best
|
||||
|
||||
for line in sys.stdin:
|
||||
nums = [int(i) for i in line.strip().split()]
|
||||
run(nums)
|
||||
Reference in New Issue
Block a user