Skip to content

Malek and Apples

Written by Iyed Baassou

Problem Statement

English

Solution

For each box Malek can sell maximum and the remainder will be

So the final result is: (0-based indexing)

Implementation

py
n = int(input())
a = list(map(int, input().split()))
    
rem = 0
    
for i in range(n):
    rem += a[i] % (i + 1)
    
print(rem)