This will give the number of coins for all combinations of coins with value 1 and 5
for b in range ( 0 , B + 1 ) : NEW_LINE INDENT if ( b * 5 > N ) : NEW_LINE INDENT break ; NEW_LINE DEDENT for a in range ( 0 , A + 1 ) : NEW_LINE INDENT if ( a + b * 5 > N ) : NEW_LINE INDENT break ; NEW_LINE DEDENT ways [ a + b * 5 ] += 5 ; NEW_LINE DEDENT DEDENT