plduhoux
2/20/2018 - 1:47 PM

ballsDistribution

int ballsDistribution(int colors, int ballsPerColor, int boxSize) {
    int nbcolmb = 0;
    int nbballs = 0;
    while (colors > 0) {
        if (nbballs / boxSize != (nbballs + ballsPerColor - 1) / boxSize) nbcolmb++;
        nbballs += ballsPerColor;
        colors--;
    }
    return nbcolmb;
}