You are viewing a single comment's thread. Return to all comments →
One possible solution using python3.6:
def gameWithCells(n, m): mult_nm = n * m if mult_nm == 1: return 1 elif n == 1 or m == 1: if n > 1: return (n // 2) + (n % 2) elif m > 1: return (m // 2) + (m % 2) else: horz_doubles = m // 2 total_supplies_on_fours = (n // 2) * horz_doubles raw_remainder = m % 2 total_remainders = ((n % 2) * (m - 1)) + (raw_remainder * n) supplies_on_remainders = (total_remainders // 2) + (total_remainders % 2) return total_supplies_on_fours + supplies_on_remainders
Seems like cookies are disabled on this browser, please enable them to open this website
Army Game
You are viewing a single comment's thread. Return to all comments →
One possible solution using python3.6: