Large Combinations
A combination C(n, r) tells how many ways there are to choose r objects from n when order does not matter. Write a function count_combinations_over that checks all values with 1 <= n <= max_n and counts how many C(n, r) values are greater than limit. Return only the count of such values.
Примеры
Ввод
100, 1000000Вывод
4075Ввод
23, 1000000Вывод
4Ввод
10, 10Вывод
25Нужно реализовать
def count_combinations_over(max_n: int, limit: int) -> int:
Теги
math
Melde dich an, um den Einreichungsverlauf zu sehen
AnmeldenMelde dich an, um den KI-Mentor zu nutzen
AnmeldenVisible tests
1
Input
100, 1000000Expected
40752
Input
23, 1000000Expected
43
Input
10, 10Expected
254
Input
5, 100Expected
05
Input
6, 5Expected
86
Input
10, 999999Expected
0Focus radio
Paused · SomaFM · Fluid