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
PostgreSQLv16

Ovdje će se prikazati rezultat izvršavanja koda

Visible tests
1
Input
100, 1000000
Expected4075
2
Input
23, 1000000
Expected4
3
Input
10, 10
Expected25
4
Input
5, 100
Expected0
5
Input
6, 5
Expected8
6
Input
10, 999999
Expected0
Focus radio
Paused · SomaFM · Fluid